Bazaar developer reference

CvCity::CountWorkedFeature(FeatureTypes) const

Defined in
CvCity.cpp, line 17789
Class
CvCity
Hook name
CivHooks::CvCity_CountWorkedFeature

Hooks

static bool BeforeCvCity_CountWorkedFeature(const CvCity* self, FeatureTypes iFeatureType, int& result);static void AfterCvCity_CountWorkedFeature(const CvCity* self, FeatureTypes iFeatureType, int& result);static int ReplaceCvCity_CountWorkedFeature(int (*original)(const CvCity*, FeatureTypes), const CvCity* self, FeatureTypes iFeatureType);CivRegisterBefore<CivHooks::CvCity_CountWorkedFeature>(host, &BeforeCvCity_CountWorkedFeature);CivRegisterAfter<CivHooks::CvCity_CountWorkedFeature>(host, &AfterCvCity_CountWorkedFeature);CivRegisterReplace<CivHooks::CvCity_CountWorkedFeature>(host, &ReplaceCvCity_CountWorkedFeature);

Code

17789int CvCity::CountWorkedFeature(FeatureTypes iFeatureType) const17790{17791	int iCount = 0;17792	int iX = getX(); int iY = getY(); int iOwner = getOwner();1779317794#if defined(MOD_GLOBAL_CITY_WORKING)17795	for (int iCityPlotLoop = 0; iCityPlotLoop < GetNumWorkablePlots(); iCityPlotLoop++)17796#else17797	for (int iCityPlotLoop = 0; iCityPlotLoop < NUM_CITY_PLOTS; iCityPlotLoop++)17798#endif17799	{17800		CvPlot* pLoopPlot = plotCity(iX, iY, iCityPlotLoop);1780117802		// Invalid plot or not owned by this player17803		if (pLoopPlot == NULL || pLoopPlot->getOwner() != iOwner) {17804			continue;17805		}1780617807		// Not being worked by this city17808		if (pLoopPlot->getWorkingCity() != this || !pLoopPlot->isBeingWorked()) {17809			continue;17810		}1781117812		if (pLoopPlot->HasFeature(iFeatureType)) {17813			++iCount;17814		}17815	}17816	17817	return iCount;17818}

Calls

Called by