Bazaar developer reference

CvCityBuildings::GetNumGreatWorks(bool) const

Defined in
CvBuildingClasses.cpp, line 3365
Class
CvCityBuildings
Hook name
CivHooks::CvCityBuildings_GetNumGreatWorks

Hooks

static bool BeforeCvCityBuildings_GetNumGreatWorks(const CvCityBuildings* self, bool bIgnoreYield, int& result);static void AfterCvCityBuildings_GetNumGreatWorks(const CvCityBuildings* self, bool bIgnoreYield, int& result);static int ReplaceCvCityBuildings_GetNumGreatWorks(int (*original)(const CvCityBuildings*, bool), const CvCityBuildings* self, bool bIgnoreYield);CivRegisterBefore<CivHooks::CvCityBuildings_GetNumGreatWorks>(host, &BeforeCvCityBuildings_GetNumGreatWorks);CivRegisterAfter<CivHooks::CvCityBuildings_GetNumGreatWorks>(host, &AfterCvCityBuildings_GetNumGreatWorks);CivRegisterReplace<CivHooks::CvCityBuildings_GetNumGreatWorks>(host, &ReplaceCvCityBuildings_GetNumGreatWorks);

Code

3363/// Accessor: How many Great Works of specific slot type present in this city?3364#if defined(MOD_GLOBAL_GREATWORK_YIELDTYPES)3365int CvCityBuildings::GetNumGreatWorks(bool bIgnoreYield) const3366#else3367int CvCityBuildings::GetNumGreatWorks() const3368#endif3369{3370#if defined(MOD_GLOBAL_GREATWORK_YIELDTYPES)3371	int iRtnValue = 0;33723373	CvCivilizationInfo *pkCivInfo = GC.getCivilizationInfo(m_pCity->getCivilizationType());3374	if (pkCivInfo)3375	{3376		for(std::vector<BuildingGreatWork>::const_iterator it = m_aBuildingGreatWork.begin(); it != m_aBuildingGreatWork.end(); ++it)3377		{3378			BuildingClassTypes eBldgClass = (*it).eBuildingClass;3379			CvBuildingClassInfo *pkClassInfo = GC.getBuildingClassInfo(eBldgClass);3380			if (pkClassInfo)3381			{3382				BuildingTypes eBuilding = (BuildingTypes)pkCivInfo->getCivilizationBuildings(eBldgClass);3383				CvBuildingEntry *pkInfo = GC.getBuildingInfo(eBuilding);3384				if (pkInfo)3385				{3386					if (bIgnoreYield || pkInfo->GetGreatWorkYieldType() != NO_YIELD)3387					{3388						iRtnValue++;3389					}3390				}3391			}3392		}3393	}3394	return iRtnValue;3395#else3396	// Simple if want total of all types3397	return m_aBuildingGreatWork.size();3398#endif3399}

Calls

Called by