CvGrandStrategyAI::GetSpaceshipPriority()
- Defined in
- CvGrandStrategyAI.cpp, line 721
- Class
- CvGrandStrategyAI
- Hook name
CivHooks::CvGrandStrategyAI_GetSpaceshipPriority
Hooks
static bool BeforeCvGrandStrategyAI_GetSpaceshipPriority(CvGrandStrategyAI* self, int& result);static void AfterCvGrandStrategyAI_GetSpaceshipPriority(CvGrandStrategyAI* self, int& result);static int ReplaceCvGrandStrategyAI_GetSpaceshipPriority(int (*original)(CvGrandStrategyAI*), CvGrandStrategyAI* self);CivRegisterBefore<CivHooks::CvGrandStrategyAI_GetSpaceshipPriority>(host, &BeforeCvGrandStrategyAI_GetSpaceshipPriority);CivRegisterAfter<CivHooks::CvGrandStrategyAI_GetSpaceshipPriority>(host, &AfterCvGrandStrategyAI_GetSpaceshipPriority);CivRegisterReplace<CivHooks::CvGrandStrategyAI_GetSpaceshipPriority>(host, &ReplaceCvGrandStrategyAI_GetSpaceshipPriority);
Code
720/// Returns Priority for Spaceship Grand Strategy721int CvGrandStrategyAI::GetSpaceshipPriority()722{723 int iPriority = 0;724725 // If SS Victory isn't even available then don't bother with anything726 VictoryTypes eVictory = (VictoryTypes) GC.getInfoTypeForString("VICTORY_SPACE_RACE", true);727 if(eVictory == NO_VICTORY || !GC.getGame().isVictoryValid(eVictory))728 {729 return -100;730 }731732 int iFlavorScience = m_pPlayer->GetFlavorManager()->GetPersonalityIndividualFlavor((FlavorTypes)GC.getInfoTypeForString("FLAVOR_SCIENCE"));733734 // the later the game the greater the chance735#if defined(MOD_AI_SMART_V3)736 if (MOD_AI_SMART_V3)737 iPriority += (4 + m_pPlayer->GetCurrentEra()) * iFlavorScience * 150 / 100;738 else739#endif740 iPriority += m_pPlayer->GetCurrentEra() * iFlavorScience * 150 / 100;741742 // if I already built the Apollo Program I am very likely to follow through743 ProjectTypes eApolloProgram = (ProjectTypes) GC.getInfoTypeForString("PROJECT_APOLLO_PROGRAM", true);744 if(eApolloProgram != NO_PROJECT)745 {746 if(GET_TEAM(m_pPlayer->getTeam()).getProjectCount(eApolloProgram) > 0)747 {748#if defined(MOD_AI_SMART_V3)749 if (MOD_AI_SMART_V3)750 iPriority += /*75*/ (GC.getAI_GS_SS_HAS_APOLLO_PROGRAM() / 2);751 else752#endif753 iPriority += /*150*/ GC.getAI_GS_SS_HAS_APOLLO_PROGRAM();754 }755 }756757 return iPriority;758}
Calls
- CustomMods::isAI_SMART_V3()
- CvFlavorManager::GetPersonalityIndividualFlavor(FlavorTypes)
- CvGame::isVictoryValid(VictoryTypes) const
- CvGlobals::getAI_GS_SS_HAS_APOLLO_PROGRAM()
- CvGlobals::getGame()
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvPlayer::GetCurrentEra() const
- CvPlayer::GetFlavorManager() const
- CvPlayer::getTeam() const
- CvTeam::getProjectCount(ProjectTypes) const
- CvTeam::getTeam(TeamTypes)