CvPlayerReligions::HasReligionInMostCities(ReligionTypes) const
- Defined in
- CvReligionClasses.cpp, line 3208
- Class
- CvPlayerReligions
- Hook name
CivHooks::CvPlayerReligions_HasReligionInMostCities
Hooks
static bool BeforeCvPlayerReligions_HasReligionInMostCities(const CvPlayerReligions* self, ReligionTypes eReligion, bool& result);static void AfterCvPlayerReligions_HasReligionInMostCities(const CvPlayerReligions* self, ReligionTypes eReligion, bool& result);static bool ReplaceCvPlayerReligions_HasReligionInMostCities(bool (*original)(const CvPlayerReligions*, ReligionTypes), const CvPlayerReligions* self, ReligionTypes eReligion);CivRegisterBefore<CivHooks::CvPlayerReligions_HasReligionInMostCities>(host, &BeforeCvPlayerReligions_HasReligionInMostCities);CivRegisterAfter<CivHooks::CvPlayerReligions_HasReligionInMostCities>(host, &AfterCvPlayerReligions_HasReligionInMostCities);CivRegisterReplace<CivHooks::CvPlayerReligions_HasReligionInMostCities>(host, &ReplaceCvPlayerReligions_HasReligionInMostCities);
Code
3207/// Do a majority of this player's cities follow a specific religion?3208bool CvPlayerReligions::HasReligionInMostCities(ReligionTypes eReligion) const3209{3210 if (eReligion <= RELIGION_PANTHEON)3211 {3212 return false;3213 }32143215 int iNumFollowingCities = 0;3216 int iLoop = 0;3217 CvCity* pCity = NULL;3218 for(pCity = m_pPlayer->firstCity(&iLoop); pCity != NULL; pCity = m_pPlayer->nextCity(&iLoop))3219 {3220 if(pCity)3221 {3222 if(pCity->GetCityReligions()->GetReligiousMajority() == eReligion)3223 {3224 iNumFollowingCities++;3225 }3226 }3227 }32283229 // Over half?3230 return (iNumFollowingCities * 2 > m_pPlayer->getNumCities());3231}
Calls
Called by
- CvCityCulture::GetTourismMultiplier(PlayerTypes, bool, bool, bool, bool, bool) const
- CvCityCulture::GetTourismTooltip()
- CvPlayerCulture::GetTourismModifierWith(PlayerTypes) const
- CvPlayerCulture::GetTourismModifierWithTooltip(PlayerTypes) const
- CvPlayerReligions::GetReligionInMostCities() const
- CvLeague::GetExtraVotesForFollowingReligion(PlayerTypes)
- CvLeagueAI::ScoreVoteChoiceYesNo(CvProposal *, int, bool)
- CvLuaPlayer::lHasReligionInMostCities(lua_State *)