Bazaar developer reference

CvCity::HasFeature(FeatureTypes) const

Defined in
CvCity.cpp, line 17206
Class
CvCity
Hook name
CivHooks::CvCity_HasFeature

Hooks

static bool BeforeCvCity_HasFeature(const CvCity* self, FeatureTypes iFeatureType, bool& result);static void AfterCvCity_HasFeature(const CvCity* self, FeatureTypes iFeatureType, bool& result);static bool ReplaceCvCity_HasFeature(bool (*original)(const CvCity*, FeatureTypes), const CvCity* self, FeatureTypes iFeatureType);CivRegisterBefore<CivHooks::CvCity_HasFeature>(host, &BeforeCvCity_HasFeature);CivRegisterAfter<CivHooks::CvCity_HasFeature>(host, &AfterCvCity_HasFeature);CivRegisterReplace<CivHooks::CvCity_HasFeature>(host, &ReplaceCvCity_HasFeature);

Code

17206bool CvCity::HasFeature(FeatureTypes iFeatureType) const17207{17208	int iX = getX(); int iY = getY(); int iOwner = getOwner();1720917210#if defined(MOD_GLOBAL_CITY_WORKING)17211	for (int iCityPlotLoop = 0; iCityPlotLoop < GetNumWorkablePlots(); iCityPlotLoop++)17212#else17213	for (int iCityPlotLoop = 0; iCityPlotLoop < NUM_CITY_PLOTS; iCityPlotLoop++)17214#endif17215	{17216		CvPlot* pLoopPlot = plotCity(iX, iY, iCityPlotLoop);1721717218		// Invalid plot or not owned by this player17219		if (pLoopPlot == NULL || pLoopPlot->getOwner() != iOwner) {17220			continue;17221		}1722217223		if (pLoopPlot->HasFeature(iFeatureType)) {17224			return true;17225		}17226	}1722717228	return false;17229}

Calls

Called by