CvGrandStrategyAI::GetGuessOtherPlayerSpaceshipPriority(PlayerTypes, int)
- Defined in
- CvGrandStrategyAI.cpp, line 1147
- Class
- CvGrandStrategyAI
- Hook name
CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority
Hooks
static bool BeforeCvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority(CvGrandStrategyAI* self, PlayerTypes ePlayer, int iWorldNumTechsAverage, int& result);static void AfterCvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority(CvGrandStrategyAI* self, PlayerTypes ePlayer, int iWorldNumTechsAverage, int& result);static int ReplaceCvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority(int (*original)(CvGrandStrategyAI*, PlayerTypes, int), CvGrandStrategyAI* self, PlayerTypes ePlayer, int iWorldNumTechsAverage);CivRegisterBefore<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority>(host, &BeforeCvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority);CivRegisterAfter<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority>(host, &AfterCvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority);CivRegisterReplace<CivHooks::CvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority>(host, &ReplaceCvGrandStrategyAI_GetGuessOtherPlayerSpaceshipPriority);
Code
1146/// Guess as to how much another Player is prioritizing the SS as his means of winning the game1147int CvGrandStrategyAI::GetGuessOtherPlayerSpaceshipPriority(PlayerTypes ePlayer, int iWorldNumTechsAverage)1148{1149 VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_SPACE_RACE", true);11501151 // If SS Victory isn't even available then don't bother with anything1152 if(eVictory == NO_VICTORY)1153 {1154 return -100;1155 }11561157 TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();11581159 // If the player has the Apollo Program we're pretty sure he's going for the SS1160 ProjectTypes eApolloProgram = (ProjectTypes) GC.getInfoTypeForString("PROJECT_APOLLO_PROGRAM", true);1161 if(eApolloProgram != NO_PROJECT)1162 {1163 if(GET_TEAM(eTeam).getProjectCount(eApolloProgram) > 0)1164 {1165 return /*150*/ GC.getAI_GS_SS_HAS_APOLLO_PROGRAM();1166 }1167 }11681169 int iNumTechs = GET_TEAM(eTeam).GetTeamTechs()->GetNumTechsKnown();11701171 // Don't divide by zero, okay?1172 if(iWorldNumTechsAverage == 0)1173 iWorldNumTechsAverage = 1;11741175 int iSSPriority = (iNumTechs - iWorldNumTechsAverage) * /*300*/ GC.getAI_GS_SS_TECH_PROGRESS_MOD() / iWorldNumTechsAverage;11761177 return iSSPriority;1178}
Calls
- CvGlobals::getAI_GS_SS_HAS_APOLLO_PROGRAM()
- CvGlobals::getAI_GS_SS_TECH_PROGRESS_MOD()
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvPlayer::getTeam() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvTeam::getProjectCount(ProjectTypes) const
- CvTeam::getTeam(TeamTypes)
- CvTeam::GetTeamTechs() const
- CvTeamTechs::GetNumTechsKnown() const