CvEspionageAI::BuildDiplomatCityList(EspionageCityList &)
- Defined in
- CvEspionageClasses.cpp, line 5396
- Class
- CvEspionageAI
- Hook name
CivHooks::CvEspionageAI_BuildDiplomatCityList
Hooks
static bool BeforeCvEspionageAI_BuildDiplomatCityList(CvEspionageAI* self, EspionageCityList& aDiplomatCityList);static void AfterCvEspionageAI_BuildDiplomatCityList(CvEspionageAI* self, EspionageCityList& aDiplomatCityList);static void ReplaceCvEspionageAI_BuildDiplomatCityList(void (*original)(CvEspionageAI*, EspionageCityList&), CvEspionageAI* self, EspionageCityList& aDiplomatCityList);CivRegisterBefore<CivHooks::CvEspionageAI_BuildDiplomatCityList>(host, &BeforeCvEspionageAI_BuildDiplomatCityList);CivRegisterAfter<CivHooks::CvEspionageAI_BuildDiplomatCityList>(host, &AfterCvEspionageAI_BuildDiplomatCityList);CivRegisterReplace<CivHooks::CvEspionageAI_BuildDiplomatCityList>(host, &ReplaceCvEspionageAI_BuildDiplomatCityList);
Code
5396void CvEspionageAI::BuildDiplomatCityList(EspionageCityList& aDiplomatCityList)5397{5398 aDiplomatCityList.clear();5399 CvPlayerCulture* pCulture = m_pPlayer->GetCulture();5400 CvDiplomacyAI* pDiploAI = m_pPlayer->GetDiplomacyAI();54015402 if (pDiploAI->IsGoingForCultureVictory())5403 {5404 for(uint ui = 0; ui < MAX_MAJOR_CIVS; ui++)5405 {5406 PlayerTypes eTargetPlayer = (PlayerTypes)ui;5407 if (pCulture->WantsDiplomatDoingPropaganda(eTargetPlayer))5408 {5409 aDiplomatCityList.push_back(GET_PLAYER(eTargetPlayer).getCapitalCity());5410 }5411 }5412 }5413 else // Going for diplo victory and others5414 {5415 std::vector<ScoreCityEntry> aCityScores;5416 for(uint ui = 0; ui < MAX_MAJOR_CIVS; ui++)5417 {5418 PlayerTypes eTargetPlayer = (PlayerTypes)ui;54195420 // don't count the player's own cities5421 if(eTargetPlayer == m_pPlayer->GetID() || !GET_PLAYER(eTargetPlayer).isAlive())5422 {5423 continue;5424 }54255426 if (m_pPlayer->GetLeagueAI()->GetDiplomatUsefulnessAtCiv(eTargetPlayer) == CvLeagueAI::DIPLOMAT_USEFULNESS_NONE)5427 {5428 continue;5429 }54305431 CvCity* pCapitalCity = GET_PLAYER(eTargetPlayer).getCapitalCity();5432 if (!pCapitalCity)5433 {5434 continue;5435 }54365437 // if we can't see it, we can't move a diplomat there.5438 if (!pCapitalCity->isRevealed(m_pPlayer->getTeam(), false))5439 {5440 continue;5441 }54425443 ScoreCityEntry kEntry;5444 kEntry.m_pCity = pCapitalCity;5445 kEntry.m_iScore = m_pPlayer->GetLeagueAI()->GetDiplomatUsefulnessAtCiv(eTargetPlayer);5446 aCityScores.push_back(kEntry);5447 }54485449 // sort5450 std::stable_sort(aCityScores.begin(), aCityScores.end(), ScoreCityEntryHighEval());54515452 // transfer values to OffenseCityList5453 for(uint ui = 0; ui < aCityScores.size(); ui++)5454 {5455 aDiplomatCityList.push_back(aCityScores[ui].m_pCity);5456 }5457 }5458}
Calls
- CvCity::isRevealed(TeamTypes, bool) const
- CvDiplomacyAI::IsGoingForCultureVictory()
- CvLeagueAI::GetDiplomatUsefulnessAtCiv(PlayerTypes)
- CvPlayer::getCapitalCity()
- CvPlayer::GetCulture() const
- CvPlayer::GetDiplomacyAI() const
- CvPlayer::GetID() const
- CvPlayer::GetLeagueAI() const
- CvPlayer::getTeam() const
- CvPlayer::isAlive() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPlayerCulture::WantsDiplomatDoingPropaganda(PlayerTypes) const
ScoreCityEntry::ScoreCityEntryScoreCityEntryHighEval::ScoreCityEntryHighEvalstd::stable_sortstd::vector::beginstd::vector::clearstd::vector::endstd::vector::operator[]std::vector::push_backstd::vector::push_backstd::vector::sizestd::vector::vector