CvCityBuildings::GetYieldFromGreatWorks(YieldTypes) const
- Defined in
- CvBuildingClasses.cpp, line 3287
- Class
- CvCityBuildings
- Hook name
CivHooks::CvCityBuildings_GetYieldFromGreatWorks
Hooks
static bool BeforeCvCityBuildings_GetYieldFromGreatWorks(const CvCityBuildings* self, YieldTypes eYield, int& result);static void AfterCvCityBuildings_GetYieldFromGreatWorks(const CvCityBuildings* self, YieldTypes eYield, int& result);static int ReplaceCvCityBuildings_GetYieldFromGreatWorks(int (*original)(const CvCityBuildings*, YieldTypes), const CvCityBuildings* self, YieldTypes eYield);CivRegisterBefore<CivHooks::CvCityBuildings_GetYieldFromGreatWorks>(host, &BeforeCvCityBuildings_GetYieldFromGreatWorks);CivRegisterAfter<CivHooks::CvCityBuildings_GetYieldFromGreatWorks>(host, &AfterCvCityBuildings_GetYieldFromGreatWorks);CivRegisterReplace<CivHooks::CvCityBuildings_GetYieldFromGreatWorks>(host, &ReplaceCvCityBuildings_GetYieldFromGreatWorks);
Code
3285#if defined(MOD_GLOBAL_GREATWORK_YIELDTYPES) || defined(MOD_API_UNIFIED_YIELDS)3286/// Accessor: How much of this yield are we generating from Great Works in our buildings?3287int CvCityBuildings::GetYieldFromGreatWorks(YieldTypes eYield) const3288{3289 int iYieldPerBuilding = GC.getBASE_CULTURE_PER_GREAT_WORK();3290 int iYieldPerWork = GET_PLAYER(m_pCity->getOwner()).GetGreatWorkYieldChange(eYield);3291 iYieldPerWork += GET_PLAYER(m_pCity->getOwner()).GetPlayerTraits()->GetGreatWorkYieldChanges(eYield);32923293 ReligionTypes eMajority = m_pCity->GetCityReligions()->GetReligiousMajority();3294 if(eMajority >= RELIGION_PANTHEON)3295 {3296 const CvReligion* pReligion = GC.getGame().GetGameReligions()->GetReligion(eMajority, m_pCity->getOwner());3297 if(pReligion)3298 {3299 iYieldPerWork += pReligion->m_Beliefs.GetGreatWorkYieldChange(m_pCity->getPopulation(), eYield);3300 BeliefTypes eSecondaryPantheon = m_pCity->GetCityReligions()->GetSecondaryReligionPantheonBelief();3301 if (eSecondaryPantheon != NO_BELIEF)3302 {3303 iYieldPerWork += GC.GetGameBeliefs()->GetEntry(eSecondaryPantheon)->GetGreatWorkYieldChange(eYield);3304 }3305 }3306 }33073308 int iWorkCount = 0;3309 int iBuildingCount = 0;33103311 CvCivilizationInfo *pkCivInfo = GC.getCivilizationInfo(m_pCity->getCivilizationType());3312 if (pkCivInfo)3313 {3314 for(std::vector<BuildingGreatWork>::const_iterator it = m_aBuildingGreatWork.begin(); it != m_aBuildingGreatWork.end(); ++it)3315 {3316 BuildingClassTypes eBldgClass = (*it).eBuildingClass;3317 CvBuildingClassInfo *pkClassInfo = GC.getBuildingClassInfo(eBldgClass);3318 if (pkClassInfo)3319 {3320 BuildingTypes eBuilding = (BuildingTypes)pkCivInfo->getCivilizationBuildings(eBldgClass);3321 CvBuildingEntry *pkInfo = GC.getBuildingInfo(eBuilding);3322 if (pkInfo)3323 {3324 iWorkCount++;3325 3326 if ((MOD_GLOBAL_GREATWORK_YIELDTYPES && eYield == pkInfo->GetGreatWorkYieldType()) || (!MOD_GLOBAL_GREATWORK_YIELDTYPES && eYield == YIELD_CULTURE))3327 {3328 iBuildingCount++;3329 }3330 }3331 }3332 }3333 }3334 int iRtnValue = (iWorkCount * iYieldPerWork) + (iBuildingCount * iYieldPerBuilding);3335#if defined(MOD_GLOBAL_GREATWORK_YIELDTYPES)3336 iRtnValue += GetThemingBonuses(eYield);3337#else3338 if (eYield == YIELD_CULTURE) {3339 iRtnValue += GetThemingBonuses();3340 }3341#endif33423343 return iRtnValue;3344}
Calls
- CustomMods::isGLOBAL_GREATWORK_YIELDTYPES()
- CvBeliefEntry::GetGreatWorkYieldChange(int) const
- CvBeliefXMLEntries::GetEntry(int)
- CvBuildingEntry::GetGreatWorkYieldType() const
- CvCity::GetCityReligions() const
- CvCity::getCivilizationType() const
- CvCity::getOwner() const
- CvCity::getPopulation(bool) const
- CvCityBuildings::GetThemingBonuses(YieldTypes) const
- CvCityReligions::GetReligiousMajority()
- CvCityReligions::GetSecondaryReligionPantheonBelief()
- CvCivilizationInfo::getCivilizationBuildings(int) const
- CvGame::GetGameReligions()
- CvGameReligions::GetReligion(ReligionTypes, PlayerTypes) const
- CvGlobals::getBASE_CULTURE_PER_GREAT_WORK()
- CvGlobals::getBuildingClassInfo(BuildingClassTypes)
- CvGlobals::getBuildingInfo(BuildingTypes)
- CvGlobals::getCivilizationInfo(CivilizationTypes)
- CvGlobals::getGame()
- CvGlobals::GetGameBeliefs() const
- CvPlayer::GetGreatWorkYieldChange(YieldTypes) const
- CvPlayer::GetPlayerTraits() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPlayerTraits::GetGreatWorkYieldChanges(YieldTypes) const
- CvReligionBeliefs::GetGreatWorkYieldChange(int, YieldTypes) const
std::_Vector_const_iterator::operator!=std::_Vector_const_iterator::operator*std::_Vector_const_iterator::operator++std::vector::beginstd::vector::end