Bazaar developer reference

CvCity::countNumForestPlots() const

Defined in
CvCity.cpp, line 2380
Class
CvCity
Hook name
CivHooks::CvCity_countNumForestPlots

Hooks

static bool BeforeCvCity_countNumForestPlots(const CvCity* self, int& result);static void AfterCvCity_countNumForestPlots(const CvCity* self, int& result);static int ReplaceCvCity_countNumForestPlots(int (*original)(const CvCity*), const CvCity* self);CivRegisterBefore<CivHooks::CvCity_countNumForestPlots>(host, &BeforeCvCity_countNumForestPlots);CivRegisterAfter<CivHooks::CvCity_countNumForestPlots>(host, &AfterCvCity_countNumForestPlots);CivRegisterReplace<CivHooks::CvCity_countNumForestPlots>(host, &ReplaceCvCity_countNumForestPlots);

Code

2380int CvCity::countNumForestPlots() const2381{2382	VALIDATE_OBJECT2383	int iCount = 0;23842385#if defined(MOD_GLOBAL_CITY_WORKING)2386	for(int iI = 0; iI < GetNumWorkablePlots(); iI++)2387#else2388	for(int iI = 0; iI < NUM_CITY_PLOTS; iI++)2389#endif2390	{2391		CvPlot* pLoopPlot = GetCityCitizens()->GetCityPlotFromIndex(iI);23922393		if(pLoopPlot != NULL)2394		{2395			if(pLoopPlot->getWorkingCity() == this)2396			{2397				if(pLoopPlot->getFeatureType() == FEATURE_FOREST)2398				{2399					++iCount;2400				}2401			}2402		}2403	}24042405	return iCount;2406}

Calls