CvMinorCivAI::DoTestProxyWarAnnouncement()
- Defined in
- CvMinorCivAI.cpp, line 3400
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_DoTestProxyWarAnnouncement
Hooks
static bool BeforeCvMinorCivAI_DoTestProxyWarAnnouncement(CvMinorCivAI* self);static void AfterCvMinorCivAI_DoTestProxyWarAnnouncement(CvMinorCivAI* self);static void ReplaceCvMinorCivAI_DoTestProxyWarAnnouncement(void (*original)(CvMinorCivAI*), CvMinorCivAI* self);CivRegisterBefore<CivHooks::CvMinorCivAI_DoTestProxyWarAnnouncement>(host, &BeforeCvMinorCivAI_DoTestProxyWarAnnouncement);CivRegisterAfter<CivHooks::CvMinorCivAI_DoTestProxyWarAnnouncement>(host, &AfterCvMinorCivAI_DoTestProxyWarAnnouncement);CivRegisterReplace<CivHooks::CvMinorCivAI_DoTestProxyWarAnnouncement>(host, &ReplaceCvMinorCivAI_DoTestProxyWarAnnouncement);
Code
3399/// Time to send out a "Help us with Units" notification?3400void CvMinorCivAI::DoTestProxyWarAnnouncement()3401{3402 for(int iNotifyLoop = 0; iNotifyLoop < MAX_MAJOR_CIVS; ++iNotifyLoop){3403 PlayerTypes eNotifyPlayer = (PlayerTypes) iNotifyLoop;3404 CvPlayerAI& kCurNotifyPlayer = GET_PLAYER(eNotifyPlayer);3405 CvTeam* pNotifyTeam = &GET_TEAM(kCurNotifyPlayer.getTeam());3406 if (!pNotifyTeam->isHasMet(GetPlayer()->getTeam()))3407 {3408 continue;3409 }34103411 for (int i = 0; i < MAX_MAJOR_CIVS; i++)3412 {3413 PlayerTypes eOtherMajor = (PlayerTypes) i;3414 if (IsProxyWarActiveForMajor(eNotifyPlayer, eOtherMajor))3415 {3416 CvPlayer* pOtherMajor = &GET_PLAYER(eOtherMajor);3417 CvAssertMsg(pOtherMajor, "Error sending out proxy war notification from a city-state. Please send Anton your save file and version.");3418 if (pOtherMajor)3419 {3420 TeamTypes eEnemyTeam = pOtherMajor->getTeam();3421 PlayerTypes eEnemyTeamLeader = GET_TEAM(eEnemyTeam).getLeaderID();3422 CvPlayer* pEnemyTeamLeader = &GET_PLAYER(eEnemyTeamLeader);3423 CvAssert(pEnemyTeamLeader);3424 if (pEnemyTeamLeader && GET_TEAM(GetPlayer()->getTeam()).GetNumTurnsAtWar(eEnemyTeam) == 1)3425 {3426 Localization::String strMessage = Localization::Lookup("TXT_KEY_NOTIFICATION_MINOR_WAR_UNIT_HELP");3427 strMessage << GetPlayer()->getCivilizationShortDescriptionKey() << pEnemyTeamLeader->getCivilizationShortDescriptionKey();3428 Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_MINOR_WAR_UNIT_HELP");3429 strSummary << GetPlayer()->getCivilizationShortDescriptionKey();34303431 AddQuestNotification(strMessage.toUTF8(), strSummary.toUTF8(), eNotifyPlayer);34323433 break;3434 }3435 }3436 }3437 }3438 }3439}
Calls
- CvMinorCivAI::AddQuestNotification(CvString, CvString, PlayerTypes, int, int, bool)
- CvMinorCivAI::GetPlayer()
- CvMinorCivAI::IsProxyWarActiveForMajor(PlayerTypes, PlayerTypes)
- CvPlayer::getCivilizationShortDescriptionKey() const
- CvPlayer::getTeam() const
- CvPlayerAI::getPlayer(PlayerTypes)
CvString::CvString- CvTeam::getLeaderID() const
- CvTeam::GetNumTurnsAtWar(TeamTypes) const
- CvTeam::getTeam(TeamTypes)
- CvTeam::isHasMet(TeamTypes) const
Localization::LookupLocalization::String::toUTF8operator<<