Bazaar developer reference

CvCity::CountPlotType(PlotTypes) const

Defined in
CvCity.cpp, line 17882
Class
CvCity
Hook name
CivHooks::CvCity_CountPlotType

Hooks

static bool BeforeCvCity_CountPlotType(const CvCity* self, PlotTypes iPlotType, int& result);static void AfterCvCity_CountPlotType(const CvCity* self, PlotTypes iPlotType, int& result);static int ReplaceCvCity_CountPlotType(int (*original)(const CvCity*, PlotTypes), const CvCity* self, PlotTypes iPlotType);CivRegisterBefore<CivHooks::CvCity_CountPlotType>(host, &BeforeCvCity_CountPlotType);CivRegisterAfter<CivHooks::CvCity_CountPlotType>(host, &AfterCvCity_CountPlotType);CivRegisterReplace<CivHooks::CvCity_CountPlotType>(host, &ReplaceCvCity_CountPlotType);

Code

17882int CvCity::CountPlotType(PlotTypes iPlotType) const17883{17884	int iCount = 0;17885	int iX = getX(); int iY = getY(); int iOwner = getOwner();1788617887#if defined(MOD_GLOBAL_CITY_WORKING)17888	for (int iCityPlotLoop = 0; iCityPlotLoop < GetNumWorkablePlots(); iCityPlotLoop++)17889#else17890	for (int iCityPlotLoop = 0; iCityPlotLoop < NUM_CITY_PLOTS; iCityPlotLoop++)17891#endif17892	{17893		CvPlot* pLoopPlot = plotCity(iX, iY, iCityPlotLoop);1789417895		// Invalid plot or not owned by this player17896		if (pLoopPlot == NULL || pLoopPlot->getOwner() != iOwner) {17897			continue;17898		}1789917900		// Not owned by this city17901		if (pLoopPlot->getWorkingCity() != this) {17902			continue;17903		}1790417905		if (pLoopPlot->HasPlotType(iPlotType)) {17906			++iCount;17907		}17908	}17909	17910	return iCount;17911}

Calls

Called by