CvCityReligions::GetSimulatedReligiousMajority()
- Defined in
- CvReligionClasses.cpp, line 3623
- Class
- CvCityReligions
- Hook name
CivHooks::CvCityReligions_GetSimulatedReligiousMajority
Hooks
static bool BeforeCvCityReligions_GetSimulatedReligiousMajority(CvCityReligions* self, ReligionTypes& result);static void AfterCvCityReligions_GetSimulatedReligiousMajority(CvCityReligions* self, ReligionTypes& result);static ReligionTypes ReplaceCvCityReligions_GetSimulatedReligiousMajority(ReligionTypes (*original)(CvCityReligions*), CvCityReligions* self);CivRegisterBefore<CivHooks::CvCityReligions_GetSimulatedReligiousMajority>(host, &BeforeCvCityReligions_GetSimulatedReligiousMajority);CivRegisterAfter<CivHooks::CvCityReligions_GetSimulatedReligiousMajority>(host, &AfterCvCityReligions_GetSimulatedReligiousMajority);CivRegisterReplace<CivHooks::CvCityReligions_GetSimulatedReligiousMajority>(host, &ReplaceCvCityReligions_GetSimulatedReligiousMajority);
Code
3622/// Just asked to simulate a conversion - who would be the majority religion?3623ReligionTypes CvCityReligions::GetSimulatedReligiousMajority()3624{3625 int iTotalFollowers = 0;3626 int iMostFollowerPressure = 0;3627 int iMostFollowers = -1;3628 ReligionTypes eMostFollowers = NO_RELIGION;3629 ReligionInCityList::iterator religionIt;36303631 for(religionIt = m_SimulatedStatus.begin(); religionIt != m_SimulatedStatus.end(); ++religionIt)3632 {3633 iTotalFollowers += religionIt->m_iFollowers;36343635 if(religionIt->m_iFollowers > iMostFollowers || religionIt->m_iFollowers == iMostFollowers && religionIt->m_iPressure > iMostFollowerPressure)3636 {3637 iMostFollowers = religionIt->m_iFollowers;3638 iMostFollowerPressure = religionIt->m_iPressure;3639 eMostFollowers = religionIt->m_eReligion;3640 }3641 }36423643 if ((iMostFollowers * 2) >= iTotalFollowers)3644 {3645 return eMostFollowers;3646 }3647 else3648 {3649 return NO_RELIGION;3650 }3651}
Calls
BaseVector::beginBaseVector::end