Bazaar developer reference

CityStrategyAIHelpers::IsTestCityStrategy_HillCity(CvCity *)

Defined in
CvCityStrategyAI.cpp, line 3012
Hook name
CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_HillCity

Hooks

static bool BeforeCityStrategyAIHelpers_IsTestCityStrategy_HillCity(CvCity* pCity, bool& result);static void AfterCityStrategyAIHelpers_IsTestCityStrategy_HillCity(CvCity* pCity, bool& result);static bool ReplaceCityStrategyAIHelpers_IsTestCityStrategy_HillCity(bool (*original)(CvCity*), CvCity* pCity);CivRegisterBefore<CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_HillCity>(host, &BeforeCityStrategyAIHelpers_IsTestCityStrategy_HillCity);CivRegisterAfter<CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_HillCity>(host, &AfterCityStrategyAIHelpers_IsTestCityStrategy_HillCity);CivRegisterReplace<CivHooks::CityStrategyAIHelpers_IsTestCityStrategy_HillCity>(host, &ReplaceCityStrategyAIHelpers_IsTestCityStrategy_HillCity);

Code

3011/// "Hill City" City Strategy: give a little flavor to this city3012bool CityStrategyAIHelpers::IsTestCityStrategy_HillCity(CvCity* pCity)3013{3014	// scan the nearby tiles to see if there are at least two hills in the vicinity3015	const int iRange = 2;3016	int iNumHills = 0;3017	CvPlot* pPlot = pCity->plot();30183019	for(int iDX = -iRange; iDX <= iRange; iDX++)3020	{3021		for(int iDY = -iRange; iDY <= iRange; iDY++)3022		{3023			CvPlot* pLoopPlot = plotXYWithRangeCheck(pPlot->getX(), pPlot->getY(), iDX, iDY, iRange);3024			if(pLoopPlot)3025			{3026				if(pLoopPlot->isHills() && pLoopPlot->getOwner() == pPlot->getOwner())3027				{3028					iNumHills++;3029					if(iNumHills > 1)3030					{3031						return true;3032					}3033				}3034			}3035		}3036	}30373038	return false;3039}

Calls

Called by