EconomicAIHelpers::IsTestStrategy_ExpandToOtherContinents(CvPlayer *)
- Defined in
- CvEconomicAI.cpp, line 4033
- Hook name
CivHooks::EconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents
Hooks
static bool BeforeEconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents(CvPlayer* pPlayer, bool& result);static void AfterEconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents(CvPlayer* pPlayer, bool& result);static bool ReplaceEconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents(bool (*original)(CvPlayer*), CvPlayer* pPlayer);CivRegisterBefore<CivHooks::EconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents>(host, &BeforeEconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents);CivRegisterAfter<CivHooks::EconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents>(host, &AfterEconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents);CivRegisterReplace<CivHooks::EconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents>(host, &ReplaceEconomicAIHelpers_IsTestStrategy_ExpandToOtherContinents);
Code
4032/// Are we running out of room on our current landmass?4033bool EconomicAIHelpers::IsTestStrategy_ExpandToOtherContinents(CvPlayer* pPlayer)4034{4035 if(GC.getGame().isOption(GAMEOPTION_ONE_CITY_CHALLENGE) && pPlayer->isHuman())4036 {4037 return false;4038 }40394040 // Never run this at the same time as island start4041 EconomicAIStrategyTypes eStrategyIslandStart = (EconomicAIStrategyTypes) GC.getInfoTypeForString("ECONOMICAISTRATEGY_ISLAND_START");4042 if(eStrategyIslandStart != NO_ECONOMICAISTRATEGY)4043 {4044 if(pPlayer->GetEconomicAI()->IsUsingStrategy(eStrategyIslandStart))4045 {4046 return false;4047 }4048 }40494050 // we should settle our island first4051 EconomicAIStrategyTypes eEarlyExpansion = (EconomicAIStrategyTypes) GC.getInfoTypeForString("ECONOMICAISTRATEGY_EARLY_EXPANSION");4052 if(eEarlyExpansion != NO_ECONOMICAISTRATEGY)4053 {4054 if(pPlayer->GetEconomicAI()->IsUsingStrategy(eEarlyExpansion))4055 {4056 return false;4057 }4058 }40594060 // Never desperate to settle distant lands if we are at war (unless we are doing okay at the war)4061 MilitaryAIStrategyTypes eStrategyAtWar = (MilitaryAIStrategyTypes) GC.getInfoTypeForString("MILITARYAISTRATEGY_LOSING_WARS");4062 if(eStrategyAtWar != NO_MILITARYAISTRATEGY)4063 {4064 if(pPlayer->GetMilitaryAI()->IsUsingStrategy(eStrategyAtWar))4065 {4066 return false;4067 }4068 }40694070 if(pPlayer->getCapitalCity() != NULL)4071 {4072 CvArea* pArea = GC.getMap().getArea(pPlayer->getCapitalCity()->getArea());40734074 // Do we have another area to settle (either first or second choice)?4075 int iBestArea, iSecondBestArea;4076 pPlayer->GetBestSettleAreas(pPlayer->GetEconomicAI()->GetMinimumSettleFertility(), iBestArea, iSecondBestArea);40774078 if((iBestArea != pArea->GetID() && iBestArea != -1) || (iSecondBestArea != pArea->GetID() && iSecondBestArea != -1))4079 {4080 return true;4081 }4082 }40834084 return false;4085}
Calls
- CvArea::GetID() const
- CvCity::getArea() const
- CvEconomicAI::GetMinimumSettleFertility() const
- CvEconomicAI::IsUsingStrategy(EconomicAIStrategyTypes)
- CvGame::isOption(GameOptionTypes) const
- CvGlobals::getGame()
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvGlobals::getMap()
- CvMap::getArea(int)
- CvMilitaryAI::IsUsingStrategy(MilitaryAIStrategyTypes)
- CvPlayer::GetBestSettleAreas(int, int &, int &)
- CvPlayer::getCapitalCity()
- CvPlayer::GetEconomicAI() const
- CvPlayer::GetMilitaryAI() const
- CvPlayer::isHuman() const