Bazaar developer reference

CvCityBuildings::GetNumGreatWorks(GreatWorkSlotType) const

Defined in
CvBuildingClasses.cpp, line 3402
Class
CvCityBuildings
Hook name
CivHooks::CvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const

Hooks

static bool BeforeCvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const(const CvCityBuildings* self, GreatWorkSlotType eGreatWorkSlot, int& result);static void AfterCvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const(const CvCityBuildings* self, GreatWorkSlotType eGreatWorkSlot, int& result);static int ReplaceCvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const(int (*original)(const CvCityBuildings*, GreatWorkSlotType), const CvCityBuildings* self, GreatWorkSlotType eGreatWorkSlot);CivRegisterBefore<CivHooks::CvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const>(host, &BeforeCvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const);CivRegisterAfter<CivHooks::CvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const>(host, &AfterCvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const);CivRegisterReplace<CivHooks::CvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const>(host, &ReplaceCvCityBuildings_GetNumGreatWorks_with_GreatWorkSlotType_const);

Code

3401/// Accessor: How many Great Works of specific slot type present in this city?3402int CvCityBuildings::GetNumGreatWorks(GreatWorkSlotType eGreatWorkSlot) const3403{3404	int iRtnValue = 0;34053406	CvCivilizationInfo *pkCivInfo = GC.getCivilizationInfo(m_pCity->getCivilizationType());3407	if (pkCivInfo)3408	{3409		for(std::vector<BuildingGreatWork>::const_iterator it = m_aBuildingGreatWork.begin(); it != m_aBuildingGreatWork.end(); ++it)3410		{3411			BuildingClassTypes eBldgClass = (*it).eBuildingClass;3412			CvBuildingClassInfo *pkClassInfo = GC.getBuildingClassInfo(eBldgClass);3413			if (pkClassInfo)3414			{3415				BuildingTypes eBuilding = (BuildingTypes)pkCivInfo->getCivilizationBuildings(eBldgClass);3416				CvBuildingEntry *pkInfo = GC.getBuildingInfo(eBuilding);3417				if (pkInfo)3418				{3419					if (pkInfo->GetGreatWorkSlotType() == eGreatWorkSlot)3420					{3421						iRtnValue++;3422					}3423				}3424			}3425		}3426	}3427	return iRtnValue;3428}

Calls

Called by