Bazaar developer reference

CvCity::countNumWaterPlots() const

Defined in
CvCity.cpp, line 2314
Class
CvCity
Hook name
CivHooks::CvCity_countNumWaterPlots

Hooks

static bool BeforeCvCity_countNumWaterPlots(const CvCity* self, int& result);static void AfterCvCity_countNumWaterPlots(const CvCity* self, int& result);static int ReplaceCvCity_countNumWaterPlots(int (*original)(const CvCity*), const CvCity* self);CivRegisterBefore<CivHooks::CvCity_countNumWaterPlots>(host, &BeforeCvCity_countNumWaterPlots);CivRegisterAfter<CivHooks::CvCity_countNumWaterPlots>(host, &AfterCvCity_countNumWaterPlots);CivRegisterReplace<CivHooks::CvCity_countNumWaterPlots>(host, &ReplaceCvCity_countNumWaterPlots);

Code

2314int CvCity::countNumWaterPlots() const2315{2316	VALIDATE_OBJECT2317	CvPlot* pLoopPlot;2318	int iCount;2319	int iI;23202321	iCount = 0;23222323	CvCityCitizens* pCityCitizens = GetCityCitizens();23242325#if defined(MOD_GLOBAL_CITY_WORKING)2326	for(iI = 0; iI < GetNumWorkablePlots(); iI++)2327#else2328	for(iI = 0; iI < NUM_CITY_PLOTS; iI++)2329#endif2330	{2331		pLoopPlot = pCityCitizens->GetCityPlotFromIndex(iI);23322333		if(pLoopPlot != NULL)2334		{2335			if(pLoopPlot->isWater())2336			{2337				if(pLoopPlot->getWorkingCity() == this)2338				{2339					iCount++;2340				}2341			}2342		}2343	}23442345	return iCount;2346}

Calls

Called by