CvCity::HasWorkedFeature(FeatureTypes) const
- Defined in
- CvCity.cpp, line 17231
- Class
- CvCity
- Hook name
CivHooks::CvCity_HasWorkedFeature
Hooks
static bool BeforeCvCity_HasWorkedFeature(const CvCity* self, FeatureTypes iFeatureType, bool& result);static void AfterCvCity_HasWorkedFeature(const CvCity* self, FeatureTypes iFeatureType, bool& result);static bool ReplaceCvCity_HasWorkedFeature(bool (*original)(const CvCity*, FeatureTypes), const CvCity* self, FeatureTypes iFeatureType);CivRegisterBefore<CivHooks::CvCity_HasWorkedFeature>(host, &BeforeCvCity_HasWorkedFeature);CivRegisterAfter<CivHooks::CvCity_HasWorkedFeature>(host, &AfterCvCity_HasWorkedFeature);CivRegisterReplace<CivHooks::CvCity_HasWorkedFeature>(host, &ReplaceCvCity_HasWorkedFeature);
Code
17231bool CvCity::HasWorkedFeature(FeatureTypes iFeatureType) const17232{17233 int iX = getX(); int iY = getY(); int iOwner = getOwner();1723417235#if defined(MOD_GLOBAL_CITY_WORKING)17236 for (int iCityPlotLoop = 0; iCityPlotLoop < GetNumWorkablePlots(); iCityPlotLoop++)17237#else17238 for (int iCityPlotLoop = 0; iCityPlotLoop < NUM_CITY_PLOTS; iCityPlotLoop++)17239#endif17240 {17241 CvPlot* pLoopPlot = plotCity(iX, iY, iCityPlotLoop);1724217243 // Invalid plot or not owned by this player17244 if (pLoopPlot == NULL || pLoopPlot->getOwner() != iOwner) {17245 continue;17246 }1724717248 // Not being worked by this city17249 if (pLoopPlot->getWorkingCity() != this || !pLoopPlot->isBeingWorked()) {17250 continue;17251 }1725217253 if (pLoopPlot->HasFeature(iFeatureType)) {17254 return true;17255 }17256 }1725717258 return false;17259}