Bazaar developer reference

CvPlayerEspionage::GetCityWithSpy(uint)

Defined in
CvEspionageClasses.cpp, line 1313
Class
CvPlayerEspionage
Hook name
CivHooks::CvPlayerEspionage_GetCityWithSpy

Hooks

static bool BeforeCvPlayerEspionage_GetCityWithSpy(CvPlayerEspionage* self, uint uiSpyIndex, CvCity*& result);static void AfterCvPlayerEspionage_GetCityWithSpy(CvPlayerEspionage* self, uint uiSpyIndex, CvCity*& result);static CvCity* ReplaceCvPlayerEspionage_GetCityWithSpy(CvCity* (*original)(CvPlayerEspionage*, uint), CvPlayerEspionage* self, uint uiSpyIndex);CivRegisterBefore<CivHooks::CvPlayerEspionage_GetCityWithSpy>(host, &BeforeCvPlayerEspionage_GetCityWithSpy);CivRegisterAfter<CivHooks::CvPlayerEspionage_GetCityWithSpy>(host, &AfterCvPlayerEspionage_GetCityWithSpy);CivRegisterReplace<CivHooks::CvPlayerEspionage_GetCityWithSpy>(host, &ReplaceCvPlayerEspionage_GetCityWithSpy);

Code

1313CvCity* CvPlayerEspionage::GetCityWithSpy(uint uiSpyIndex)1314{1315	CvAssertMsg(uiSpyIndex < m_aSpyList.size(), "uiSpyIndex is out of bounds");1316	if(uiSpyIndex >= m_aSpyList.size())1317	{1318		return false;1319	}13201321	if(m_aSpyList[uiSpyIndex].m_iCityX == -1 && m_aSpyList[uiSpyIndex].m_iCityY == -1)1322	{1323		return NULL;1324	}13251326	CvPlot* pCityPlot = GC.getMap().plot(m_aSpyList[uiSpyIndex].m_iCityX, m_aSpyList[uiSpyIndex].m_iCityY);1327	CvAssertMsg(pCityPlot, "pCityPlot is null. This should have been caught above");1328	CvCity* pCity = NULL;1329	if(pCityPlot)1330	{1331		pCity = pCityPlot->getPlotCity();1332		CvAssertMsg(pCity, "Spy is pointing to empty city, what's up with that");1333	}13341335	return pCity;1336}

Calls

Called by