CvCity::countNumRiverPlots() const
- Defined in
- CvCity.cpp, line 2349
- Class
- CvCity
- Hook name
CivHooks::CvCity_countNumRiverPlots
Hooks
static bool BeforeCvCity_countNumRiverPlots(const CvCity* self, int& result);static void AfterCvCity_countNumRiverPlots(const CvCity* self, int& result);static int ReplaceCvCity_countNumRiverPlots(int (*original)(const CvCity*), const CvCity* self);CivRegisterBefore<CivHooks::CvCity_countNumRiverPlots>(host, &BeforeCvCity_countNumRiverPlots);CivRegisterAfter<CivHooks::CvCity_countNumRiverPlots>(host, &AfterCvCity_countNumRiverPlots);CivRegisterReplace<CivHooks::CvCity_countNumRiverPlots>(host, &ReplaceCvCity_countNumRiverPlots);
Code
2349int CvCity::countNumRiverPlots() const2350{2351 VALIDATE_OBJECT2352 int iCount = 0;23532354 CvCityCitizens* pCityCitizens = GetCityCitizens();23552356#if defined(MOD_GLOBAL_CITY_WORKING)2357 for(int iI = 0; iI < GetNumWorkablePlots(); iI++)2358#else2359 for(int iI = 0; iI < NUM_CITY_PLOTS; iI++)2360#endif2361 {2362 CvPlot* pLoopPlot = pCityCitizens->GetCityPlotFromIndex(iI);23632364 if(pLoopPlot != NULL)2365 {2366 if(pLoopPlot->isRiver())2367 {2368 if(pLoopPlot->getWorkingCity() == this)2369 {2370 ++iCount;2371 }2372 }2373 }2374 }23752376 return iCount;2377}