CvCityReligions::GetReligiousMajority()
- Defined in
- CvReligionClasses.cpp, line 3592
- Class
- CvCityReligions
- Hook name
CivHooks::CvCityReligions_GetReligiousMajority
Hooks
static bool BeforeCvCityReligions_GetReligiousMajority(CvCityReligions* self, ReligionTypes& result);static void AfterCvCityReligions_GetReligiousMajority(CvCityReligions* self, ReligionTypes& result);static ReligionTypes ReplaceCvCityReligions_GetReligiousMajority(ReligionTypes (*original)(CvCityReligions*), CvCityReligions* self);CivRegisterBefore<CivHooks::CvCityReligions_GetReligiousMajority>(host, &BeforeCvCityReligions_GetReligiousMajority);CivRegisterAfter<CivHooks::CvCityReligions_GetReligiousMajority>(host, &AfterCvCityReligions_GetReligiousMajority);CivRegisterReplace<CivHooks::CvCityReligions_GetReligiousMajority>(host, &ReplaceCvCityReligions_GetReligiousMajority);
Code
3591/// Is there a religion that at least half of the population follows?3592ReligionTypes CvCityReligions::GetReligiousMajority()3593{3594 int iTotalFollowers = 0;3595 int iMostFollowerPressure = 0;3596 int iMostFollowers = -1;3597 ReligionTypes eMostFollowers = NO_RELIGION;3598 ReligionInCityList::iterator religionIt;35993600 for(religionIt = m_ReligionStatus.begin(); religionIt != m_ReligionStatus.end(); ++religionIt)3601 {3602 iTotalFollowers += religionIt->m_iFollowers;36033604 if(religionIt->m_iFollowers > iMostFollowers || religionIt->m_iFollowers == iMostFollowers && religionIt->m_iPressure > iMostFollowerPressure)3605 {3606 iMostFollowers = religionIt->m_iFollowers;3607 iMostFollowerPressure = religionIt->m_iPressure;3608 eMostFollowers = religionIt->m_eReligion;3609 }3610 }36113612 if ((iMostFollowers * 2) >= iTotalFollowers)3613 {3614 return eMostFollowers;3615 }3616 else3617 {3618 return NO_RELIGION;3619 }3620}
Calls
BaseVector::beginBaseVector::end
Called by
74 functions in 11 files
- CvCityBuildings::GetYieldFromGreatWorks(YieldTypes) const
- CvCity::GetBaseYieldRateFromReligion(YieldTypes) const
- CvCity::GetFaithPurchaseCost(UnitTypes, bool)
- CvCity::GetJONSCultureThreshold() const
- CvCity::GetLocalHappiness() const
- CvCity::GetYieldPerTurnFromUnimprovedFeatures(YieldTypes) const
- CvCity::HasBelief(BeliefTypes) const
- CvCity::IsCanPurchase(bool, bool, UnitTypes, BuildingTypes, ProjectTypes, YieldTypes)
- CvCity::Purchase(UnitTypes, BuildingTypes, ProjectTypes, YieldTypes)
- CvCity::SetRouteToCapitalConnected(bool)
- CvCity::foodDifferenceTimes100(bool, CvString *) const
- CvCity::getBaseYieldRateModifier(YieldTypes, int, CvString *) const
- CvCity::getExtraSpecialistYield(YieldTypes, SpecialistTypes) const
- CvCity::getProductionModifier(BuildingTypes, CvString *) const
- CvCity::getStrengthValue(bool) const
- CvCity::processBuilding(BuildingTypes, int, bool, bool, bool)
- CvCity::setPopulation(int, bool)
- CvCityCitizens::DoAddSpecialistToBuilding(BuildingTypes, bool)
- CvCityCitizens::DoRemoveSpecialistFromBuilding(BuildingTypes, bool, bool)
- CvCityCitizens::DoSpecialists()
- CvCityCitizens::IsAIWantSpecialistRightNow()
- CvCityCulture::GetBaseTourismBeforeModifiers()
- CvCityCulture::GetTourismTooltip()
- CvGameCulture::GetGreatWorkTooltip(int, PlayerTypes) const
- CvMinorCivAI::GetFriendshipAnchorWithMajor(PlayerTypes)
- CvMinorCivAI::IsSameReligionAsMajor(PlayerTypes)
- CvMinorCivQuest::IsComplete()
- CvPlot::calculateImprovementYieldChange(ImprovementTypes, YieldTypes, PlayerTypes, bool, RouteTypes) const
- CvPlot::calculateNatureYield(YieldTypes, TeamTypes, bool) const
- CvCityReligions::AddHolyCityPressure()
- CvCityReligions::AddProphetSpread(ReligionTypes, int, PlayerTypes)
- CvCityReligions::AddReligiousPressure(CvReligiousFollowChangeReason, ReligionTypes, int, PlayerTypes)
- CvCityReligions::AddSpyPressure(ReligionTypes, int)
- CvCityReligions::DoPopulationChange(int)
- CvCityReligions::DoReligionFounded(ReligionTypes)
- CvCityReligions::GetPressurePerTurn(ReligionTypes, int &)
- CvCityReligions::GetSecondaryReligion()
- CvCityReligions::LogFollowersChange(CvReligiousFollowChangeReason)
- CvCityReligions::RecomputeFollowers(CvReligiousFollowChangeReason, ReligionTypes, PlayerTypes)
- CvCityReligions::RemoveFormerPantheon()
- CvCityReligions::RemoveOtherReligions(ReligionTypes, PlayerTypes)
- CvCityReligions::UpdateNumTradeRouteConnections(CvCity *)
- CvCityReligions::WouldExertTradeRoutePressureToward(CvCity *, ReligionTypes &, int &)
- CvGameReligions::GetBeliefYieldForKill(YieldTypes, int, int, PlayerTypes)
- CvGameReligions::GetNumCitiesFollowing(ReligionTypes) const
- CvGameReligions::SpreadReligionToOneCity(CvCity *)
- CvGameReligions::UpdateAllCitiesThisReligion(ReligionTypes)
- CvPlayerReligions::GetNumForeignCitiesFollowing() const
- CvPlayerReligions::HasOthersReligionInMostCities(PlayerTypes) const
- CvPlayerReligions::HasReligionInMostCities(ReligionTypes) const
- CvPlayerReligions::HasReligiousCity() const
- CvReligionAI::AreAllOurCitiesConverted(ReligionTypes, bool) const
- CvReligionAI::AreAllOurCitiesHaveFaithBuilding(ReligionTypes, bool) const
- CvReligionAI::BuyAnyAvailableFaithBuilding()
- CvReligionAI::ChooseProphetConversionCity(bool) const
- CvReligionAI::HaveEnoughInquisitors(ReligionTypes) const
- CvReligionAI::HaveNearbyConversionTarget(ReligionTypes, bool) const
- CvReligionAI::ScoreCityForInquisitor(CvCity *, UnitHandle)
- CvReligionAI::ScoreCityForMissionary(CvCity *, UnitHandle)
- CvReligionAIHelpers::DoesUnitPassFaithPurchaseCheck(CvPlayer &, UnitTypes)
- CvReligionAIHelpers::GetBestCityFaithUnitPurchase(CvPlayer &, UnitTypes, ReligionTypes)
- CvPlayerTrade::GetTradeConnectionPolicyValueTimes100(const TradeConnection &, YieldTypes)
- CvUnit::DoSpreadReligion()
- CvUnit::GetGenericMaxStrengthModifier(const CvUnit *, const CvPlot *, bool) const
- CvUnit::GetMaxRangedCombatStrength(const CvUnit *, const CvCity *, bool, bool) const
- CvUnit::healRate(const CvPlot *) const
- CvUnit::initWithNameOffset(int, UnitTypes, int, UnitAITypes, PlayerTypes, int, int, DirectionTypes, bool, bool, int, int)
- CvLuaCity::lGetFaithBuildingTourism(lua_State *)
- CvLuaCity::lGetReligionBuildingClassHappiness(lua_State *)
- CvLuaCity::lGetReligionBuildingClassYieldChange(lua_State *)
- CvLuaCity::lGetReligionCityRangeStrikeModifier(lua_State *)
- CvLuaCity::lGetReligiousMajority(lua_State *)
- CvLuaPlayer::lGetFoundedReligionEnemyCityCombatMod(lua_State *)
- CvLuaPlayer::lGetFoundedReligionFriendlyCityCombatMod(lua_State *)