CvGrandStrategyAI::GetGuessOtherPlayerUnitedNationsPriority(PlayerTypes)
- Defined in
- CvGrandStrategyAI.cpp, line 1107
- Class
- CvGrandStrategyAI
- Hook name
CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority
Hooks
static bool BeforeCvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority(CvGrandStrategyAI* self, PlayerTypes ePlayer, int& result);static void AfterCvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority(CvGrandStrategyAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority(int (*original)(CvGrandStrategyAI*, PlayerTypes), CvGrandStrategyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority>(host, &BeforeCvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority);CivRegisterAfter<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority>(host, &AfterCvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority);CivRegisterReplace<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority>(host, &ReplaceCvGrandStrategyAI_GetGuessOtherPlayerUnitedNationsPriority);
Code
1106/// Guess as to how much another Player is prioritizing the UN as his means of winning the game1107int CvGrandStrategyAI::GetGuessOtherPlayerUnitedNationsPriority(PlayerTypes ePlayer)1108{1109 VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_DIPLOMATIC", true);11101111 // If UN Victory isn't even available then don't bother with anything1112 if(eVictory == NO_VICTORY)1113 {1114 return -100;1115 }11161117 int iTheirCityStateAllies = 0;1118 int iTheirCityStateFriends = 0;1119 int iCityStatesAlive = 0;1120 for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)1121 {1122 PlayerTypes eLoopPlayer = (PlayerTypes) iPlayerLoop;11231124 if (eLoopPlayer != ePlayer && GET_PLAYER(eLoopPlayer).isAlive() && GET_PLAYER(eLoopPlayer).isMinorCiv())1125 {1126 iCityStatesAlive++;1127 if (GET_PLAYER(eLoopPlayer).GetMinorCivAI()->IsAllies(ePlayer))1128 {1129 iTheirCityStateAllies++;1130 }1131 else if (GET_PLAYER(eLoopPlayer).GetMinorCivAI()->IsFriends(ePlayer))1132 {1133 iTheirCityStateFriends++;1134 }1135 }1136 }1137 iCityStatesAlive = MAX(iCityStatesAlive, 1);11381139 int iPriority = iTheirCityStateAllies + (iTheirCityStateFriends / 3);1140 iPriority = iPriority * GC.getAI_GS_UN_SECURED_VOTE_MOD();1141 iPriority = iPriority / iCityStatesAlive;11421143 return iPriority;1144}
Calls
- CvGlobals::getAI_GS_UN_SECURED_VOTE_MOD()
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvMinorCivAI::IsAllies(PlayerTypes) const
- CvMinorCivAI::IsFriends(PlayerTypes)
- CvPlayer::GetMinorCivAI() const
- CvPlayer::isAlive() const
- CvPlayer::isMinorCiv() const
- CvPlayerAI::getPlayer(PlayerTypes)
std::max