CvDiplomacyAI::GetNumOurEnemiesPlayerAtWarWith(PlayerTypes)
- Defined in
- CvDiplomacyAI.cpp, line 24328
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith
Hooks
static bool BeforeCvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static void AfterCvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith(int (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith>(host, &BeforeCvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith);CivRegisterAfter<CivHooks::CvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith>(host, &AfterCvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith);CivRegisterReplace<CivHooks::CvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith>(host, &ReplaceCvDiplomacyAI_GetNumOurEnemiesPlayerAtWarWith);
Code
24327/// How many players that we're Competitive or more with is ePlayer at war with?24328int CvDiplomacyAI::GetNumOurEnemiesPlayerAtWarWith(PlayerTypes ePlayer)24329{24330 CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");24331 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");2433224333 int iAtWarCount = 0;2433424335 TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();2433624337 TeamTypes eLoopTeam;24338 PlayerTypes eLoopPlayer;24339 for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)24340 {24341 eLoopPlayer = (PlayerTypes) iPlayerLoop;2434224343 if(IsPlayerValid(eLoopPlayer))24344 {24345 if(IsAtWar(eLoopPlayer))24346 {24347 eLoopTeam = GET_PLAYER(eLoopPlayer).getTeam();2434824349 if(GET_TEAM(eTeam).isAtWar(eLoopTeam))24350 {24351 iAtWarCount++;24352 }24353 }24354 }24355 }2435624357 return iAtWarCount;24358}