CityStrategyAIHelpers::IsTestCityStrategy_JungleCity(CvCity *)
- Defined in
- CvCityStrategyAI.cpp, line 3094
- Hook name
CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_JungleCity
Hooks
static bool BeforeCityStrategyAIHelpers_IsTestCityStrategy_JungleCity(CvCity* pCity, bool& result);static void AfterCityStrategyAIHelpers_IsTestCityStrategy_JungleCity(CvCity* pCity, bool& result);static bool ReplaceCityStrategyAIHelpers_IsTestCityStrategy_JungleCity(bool (*original)(CvCity*), CvCity* pCity);CivRegisterBefore<CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_JungleCity>(host, &BeforeCityStrategyAIHelpers_IsTestCityStrategy_JungleCity);CivRegisterAfter<CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_JungleCity>(host, &AfterCityStrategyAIHelpers_IsTestCityStrategy_JungleCity);CivRegisterReplace<CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_JungleCity>(host, &ReplaceCityStrategyAIHelpers_IsTestCityStrategy_JungleCity);
Code
3093/// "Jungle City" City Strategy: give a little flavor to this city3094bool CityStrategyAIHelpers::IsTestCityStrategy_JungleCity(CvCity* pCity)3095{3096 // scan the nearby tiles to see if there are at least two jungles in the vicinity3097 const int iRange = 2;3098 int iNumJungles = 0;3099 CvPlot* pPlot = pCity->plot();31003101 for(int iDX = -iRange; iDX <= iRange; iDX++)3102 {3103 for(int iDY = -iRange; iDY <= iRange; iDY++)3104 {3105 CvPlot* pLoopPlot = plotXYWithRangeCheck(pPlot->getX(), pPlot->getY(), iDX, iDY, iRange);3106 if(pLoopPlot)3107 {3108 // FEATURE_JUNGLE seems dubious to me...3109 if(pLoopPlot->getFeatureType() == FEATURE_JUNGLE && pLoopPlot->getOwner() == pPlot->getOwner())3110 {3111 iNumJungles++;3112 if(iNumJungles > 1)3113 {3114 return true;3115 }3116 }3117 }3118 }3119 }31203121 return false;3122}