Bazaar developer reference

CvPlayer::countNumBuildings(BuildingTypes) const

Defined in
CvPlayer.cpp, line 5736
Class
CvPlayer
Hook name
CivHooks::CvPlayer_countNumBuildings

Hooks

static bool BeforeCvPlayer_countNumBuildings(const CvPlayer* self, BuildingTypes eBuilding, int& result);static void AfterCvPlayer_countNumBuildings(const CvPlayer* self, BuildingTypes eBuilding, int& result);static int ReplaceCvPlayer_countNumBuildings(int (*original)(const CvPlayer*, BuildingTypes), const CvPlayer* self, BuildingTypes eBuilding);CivRegisterBefore<CivHooks::CvPlayer_countNumBuildings>(host, &BeforeCvPlayer_countNumBuildings);CivRegisterAfter<CivHooks::CvPlayer_countNumBuildings>(host, &AfterCvPlayer_countNumBuildings);CivRegisterReplace<CivHooks::CvPlayer_countNumBuildings>(host, &ReplaceCvPlayer_countNumBuildings);

Code

5736int CvPlayer::countNumBuildings(BuildingTypes eBuilding) const5737{5738	const CvCity* pLoopCity;5739	int iCount;5740	int iLoop;57415742	iCount = 0;57435744	for(pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))5745	{5746		if(pLoopCity->GetCityBuildings()->GetNumBuilding(eBuilding) > 0)5747		{5748			iCount += pLoopCity->GetCityBuildings()->GetNumBuilding(eBuilding);5749		}5750	}57515752	return iCount;5753}

Calls

Called by