EconomicAIHelpers::IsTestStrategy_ReallyExpandToOtherContinents(CvPlayer *)
- Defined in
- CvEconomicAI.cpp, line 4089
- Hook name
CivHooks::EconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents
Hooks
static bool BeforeEconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents(CvPlayer* pPlayer, bool& result);static void AfterEconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents(CvPlayer* pPlayer, bool& result);static bool ReplaceEconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents(bool (*original)(CvPlayer*), CvPlayer* pPlayer);CivRegisterBefore<CivHooks::EconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents>(host, &BeforeEconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents);CivRegisterAfter<CivHooks::EconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents>(host, &AfterEconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents);CivRegisterReplace<CivHooks::EconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents>(host, &ReplaceEconomicAIHelpers_IsTestStrategy_ReallyExpandToOtherContinents);
Code
4088/// Is there a lot more room on a known island other than our current landmass?4089bool EconomicAIHelpers::IsTestStrategy_ReallyExpandToOtherContinents(CvPlayer* pPlayer)4090{4091 if(GC.getGame().isOption(GAMEOPTION_ONE_CITY_CHALLENGE) && pPlayer->isHuman())4092 {4093 return false;4094 }40954096 // Only run this if we are running "ExpandToOtherContinents"4097 EconomicAIStrategyTypes eStrategyExpandToOtherContinents = (EconomicAIStrategyTypes) GC.getInfoTypeForString("ECONOMICAISTRATEGY_EXPAND_TO_OTHER_CONTINENTS");4098 if(eStrategyExpandToOtherContinents != NO_ECONOMICAISTRATEGY)4099 {4100 if(!pPlayer->GetEconomicAI()->IsUsingStrategy(eStrategyExpandToOtherContinents))4101 {4102 return false;4103 }4104 }41054106 MilitaryAIStrategyTypes eStrategyLosingAtWar = (MilitaryAIStrategyTypes) GC.getInfoTypeForString("MILITARYAISTRATEGY_LOSING_WARS");4107 if(eStrategyLosingAtWar != NO_MILITARYAISTRATEGY)4108 {4109 if(pPlayer->GetMilitaryAI()->IsUsingStrategy(eStrategyLosingAtWar))4110 {4111 return false;4112 }4113 }41144115 // if we are at war probably shouldn't (unless the map is an offshore expansion map)4116 if ((GC.getMap().GetAIMapHint() & 4) == 0)4117 {4118 MilitaryAIStrategyTypes eStrategyAtWar = (MilitaryAIStrategyTypes) GC.getInfoTypeForString("MILITARYAISTRATEGY_AT_WAR");4119 if(eStrategyAtWar != NO_MILITARYAISTRATEGY)4120 {4121 if(pPlayer->GetMilitaryAI()->IsUsingStrategy(eStrategyAtWar))4122 {4123 return false;4124 }4125 }4126 }41274128 int iFlavorGrowth = pPlayer->GetGrandStrategyAI()->GetPersonalityAndGrandStrategy((FlavorTypes)GC.getInfoTypeForString("FLAVOR_GROWTH"));4129 int iFlavorExpansion = pPlayer->GetGrandStrategyAI()->GetPersonalityAndGrandStrategy((FlavorTypes)GC.getInfoTypeForString("FLAVOR_EXPANSION"));41304131 if (iFlavorGrowth < iFlavorExpansion && pPlayer->getCapitalCity() != NULL && !pPlayer->IsEmpireUnhappy())4132 {4133 // If the other area is clearly better4134 int iBestArea, iSecondBestArea;4135 pPlayer->GetBestSettleAreas(pPlayer->GetEconomicAI()->GetMinimumSettleFertility(), iBestArea, iSecondBestArea);4136 if ((iBestArea != pPlayer->getCapitalCity()->getArea() && iBestArea != -1))4137 {4138 return true;4139 }4140 }41414142 return false;4143}
Calls
- CvCity::getArea() const
- CvEconomicAI::GetMinimumSettleFertility() const
- CvEconomicAI::IsUsingStrategy(EconomicAIStrategyTypes)
- CvGame::isOption(GameOptionTypes) const
- CvGlobals::getGame()
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvGlobals::getMap()
- CvGrandStrategyAI::GetPersonalityAndGrandStrategy(FlavorTypes, bool)
- CvMap::GetAIMapHint()
- CvMilitaryAI::IsUsingStrategy(MilitaryAIStrategyTypes)
- CvPlayer::GetBestSettleAreas(int, int &, int &)
- CvPlayer::getCapitalCity()
- CvPlayer::GetEconomicAI() const
- CvPlayer::GetGrandStrategyAI() const
- CvPlayer::GetMilitaryAI() const
- CvPlayer::IsEmpireUnhappy() const
- CvPlayer::isHuman() const