Bazaar developer reference

CvCity::HasWorkedPlotType(PlotTypes) const

Defined in
CvCity.cpp, line 17371
Class
CvCity
Hook name
CivHooks::CvCity_HasWorkedPlotType

Hooks

static bool BeforeCvCity_HasWorkedPlotType(const CvCity* self, PlotTypes iPlotType, bool& result);static void AfterCvCity_HasWorkedPlotType(const CvCity* self, PlotTypes iPlotType, bool& result);static bool ReplaceCvCity_HasWorkedPlotType(bool (*original)(const CvCity*, PlotTypes), const CvCity* self, PlotTypes iPlotType);CivRegisterBefore<CivHooks::CvCity_HasWorkedPlotType>(host, &BeforeCvCity_HasWorkedPlotType);CivRegisterAfter<CivHooks::CvCity_HasWorkedPlotType>(host, &AfterCvCity_HasWorkedPlotType);CivRegisterReplace<CivHooks::CvCity_HasWorkedPlotType>(host, &ReplaceCvCity_HasWorkedPlotType);

Code

17371bool CvCity::HasWorkedPlotType(PlotTypes iPlotType) const17372{17373	int iX = getX(); int iY = getY(); int iOwner = getOwner();1737417375#if defined(MOD_GLOBAL_CITY_WORKING)17376	for (int iCityPlotLoop = 0; iCityPlotLoop < GetNumWorkablePlots(); iCityPlotLoop++)17377#else17378	for (int iCityPlotLoop = 0; iCityPlotLoop < NUM_CITY_PLOTS; iCityPlotLoop++)17379#endif17380	{17381		CvPlot* pLoopPlot = plotCity(iX, iY, iCityPlotLoop);1738217383		// Invalid plot or not owned by this player17384		if (pLoopPlot == NULL || pLoopPlot->getOwner() != iOwner) {17385			continue;17386		}1738717388		// Not being worked by this city17389		if (pLoopPlot->getWorkingCity() != this || !pLoopPlot->isBeingWorked()) {17390			continue;17391		}1739217393		if (pLoopPlot->HasPlotType(iPlotType)) {17394			return true;17395		}17396	}1739717398	return false;17399}

Calls

Called by