Bazaar developer reference

CvGameReligions::IsInSomeReligion(BeliefTypes, PlayerTypes) const

Defined in
CvReligionClasses.cpp, line 1679
Class
CvGameReligions
Hook name
CivHooks::CvGameReligions_IsInSomeReligion

Hooks

static bool BeforeCvGameReligions_IsInSomeReligion(const CvGameReligions* self, BeliefTypes eBelief, PlayerTypes ePlayer, bool& result);static void AfterCvGameReligions_IsInSomeReligion(const CvGameReligions* self, BeliefTypes eBelief, PlayerTypes ePlayer, bool& result);static bool ReplaceCvGameReligions_IsInSomeReligion(bool (*original)(const CvGameReligions*, BeliefTypes, PlayerTypes), const CvGameReligions* self, BeliefTypes eBelief, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvGameReligions_IsInSomeReligion>(host, &BeforeCvGameReligions_IsInSomeReligion);CivRegisterAfter<CivHooks::CvGameReligions_IsInSomeReligion>(host, &AfterCvGameReligions_IsInSomeReligion);CivRegisterReplace<CivHooks::CvGameReligions_IsInSomeReligion>(host, &ReplaceCvGameReligions_IsInSomeReligion);

Code

1676/// Has some religion already claimed this belief?1677#if defined(MOD_TRAITS_ANY_BELIEF)1678// We don't care if either ePlayer has the "can have any belief" trait or it's in the "religion" of a player with that trait1679bool CvGameReligions::IsInSomeReligion(BeliefTypes eBelief, PlayerTypes ePlayer) const1680#else1681bool CvGameReligions::IsInSomeReligion(BeliefTypes eBelief) const1682#endif1683{1684#if defined(MOD_TRAITS_ANY_BELIEF)1685	bool bAnyBelief = (ePlayer == NO_PLAYER) ? false : GET_PLAYER(ePlayer).GetPlayerTraits()->IsAnyBelief();1686#endif16871688	ReligionList::const_iterator it;1689	for(it = m_CurrentReligions.begin(); it != m_CurrentReligions.end(); it++)1690	{16911692		if(it->m_Beliefs.HasBelief(eBelief))1693		{1694#if defined(MOD_TRAITS_ANY_BELIEF)1695			if (MOD_TRAITS_ANY_BELIEF) {1696				if (it->m_eFounder == ePlayer) {1697					// If it's in my religion I definitely can't have it again1698					return true;1699				} else if (bAnyBelief) {1700					// In the religion of someone else, but I can have any belief, so I can have it as well1701					continue;1702				} else if (GET_PLAYER(it->m_eFounder).GetPlayerTraits()->IsAnyBelief()) {1703					// In a religion of someone who can have any belief, so I can have it as well1704					continue;1705				}1706			}1707#endif17081709			return true;1710		}1711	}17121713	return false;1714}

Calls

Called by