Bazaar developer reference

CvEspionageAI::BuildDefenseCityList(EspionageCityList &)

Defined in
CvEspionageClasses.cpp, line 5642
Class
CvEspionageAI
Hook name
CivHooks::CvEspionageAI_BuildDefenseCityList

Hooks

static bool BeforeCvEspionageAI_BuildDefenseCityList(CvEspionageAI* self, EspionageCityList& aDefenseCityList);static void AfterCvEspionageAI_BuildDefenseCityList(CvEspionageAI* self, EspionageCityList& aDefenseCityList);static void ReplaceCvEspionageAI_BuildDefenseCityList(void (*original)(CvEspionageAI*, EspionageCityList&), CvEspionageAI* self, EspionageCityList& aDefenseCityList);CivRegisterBefore<CivHooks::CvEspionageAI_BuildDefenseCityList>(host, &BeforeCvEspionageAI_BuildDefenseCityList);CivRegisterAfter<CivHooks::CvEspionageAI_BuildDefenseCityList>(host, &AfterCvEspionageAI_BuildDefenseCityList);CivRegisterReplace<CivHooks::CvEspionageAI_BuildDefenseCityList>(host, &ReplaceCvEspionageAI_BuildDefenseCityList);

Code

5642void CvEspionageAI::BuildDefenseCityList(EspionageCityList& aDefenseCityList)5643{5644	CvPlayerEspionage* pEspionage = m_pPlayer->GetEspionage();56455646	aDefenseCityList.clear();5647	PlayerTypes ePlayer = m_pPlayer->GetID();56485649	std::vector<ScoreCityEntry> aCityScores;56505651	CvCity* pLoopCity = NULL;5652	int iLoop = 0;5653	for(pLoopCity = GET_PLAYER(ePlayer).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(ePlayer).nextCity(&iLoop))5654	{5655		ScoreCityEntry kEntry;5656		kEntry.m_pCity = pLoopCity;5657		kEntry.m_iScore = pEspionage->CalcPerTurn(SPY_STATE_GATHERING_INTEL, pLoopCity, -1);5658		aCityScores.push_back(kEntry);5659	}56605661	// sort5662	std::stable_sort(aCityScores.begin(), aCityScores.end(), ScoreCityEntryHighEval());56635664	// transfer values to aDefenseCityList5665	for(uint ui = 0; ui < aCityScores.size(); ui++)5666	{5667		aDefenseCityList.push_back(aCityScores[ui].m_pCity);5668	}5669}

Calls

Called by