CvGameReligions::GetAvailablePantheonBeliefs(PlayerTypes)
- Defined in
- CvReligionClasses.cpp, line 1769
- Class
- CvGameReligions
- Hook name
CivHooks::CvGameReligions_GetAvailablePantheonBeliefs- Lua events
GameEvents.PlayerCanHaveBelief
Hooks
static bool BeforeCvGameReligions_GetAvailablePantheonBeliefs(CvGameReligions* self, PlayerTypes ePlayer, std::vector<BeliefTypes>& result);static void AfterCvGameReligions_GetAvailablePantheonBeliefs(CvGameReligions* self, PlayerTypes ePlayer, std::vector<BeliefTypes>& result);static std::vector<BeliefTypes> ReplaceCvGameReligions_GetAvailablePantheonBeliefs(std::vector<BeliefTypes> (*original)(CvGameReligions*, PlayerTypes), CvGameReligions* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvGameReligions_GetAvailablePantheonBeliefs>(host, &BeforeCvGameReligions_GetAvailablePantheonBeliefs);CivRegisterAfter<CivHooks::CvGameReligions_GetAvailablePantheonBeliefs>(host, &AfterCvGameReligions_GetAvailablePantheonBeliefs);CivRegisterReplace<CivHooks::CvGameReligions_GetAvailablePantheonBeliefs>(host, &ReplaceCvGameReligions_GetAvailablePantheonBeliefs);
Code
1767/// List of beliefs that can be adopted by pantheons1768#if defined(MOD_EVENTS_ACQUIRE_BELIEFS) || defined(MOD_TRAITS_ANY_BELIEF)1769std::vector<BeliefTypes> CvGameReligions::GetAvailablePantheonBeliefs(PlayerTypes ePlayer)1770#else1771std::vector<BeliefTypes> CvGameReligions::GetAvailablePantheonBeliefs()1772#endif1773{1774 std::vector<BeliefTypes> availableBeliefs;17751776 CvBeliefXMLEntries* pkBeliefs = GC.GetGameBeliefs();1777 const int iNumBeleifs = pkBeliefs->GetNumBeliefs();17781779 availableBeliefs.reserve(iNumBeleifs);1780 for(int iI = 0; iI < iNumBeleifs; iI++)1781 {1782 const BeliefTypes eBelief(static_cast<BeliefTypes>(iI));1783#if defined(MOD_TRAITS_ANY_BELIEF)1784 if(!IsInSomeReligion(eBelief, ePlayer))1785#else1786 if(!IsInSomeReligion(eBelief))1787#endif1788 {1789 CvBeliefEntry* pEntry = pkBeliefs->GetEntry(eBelief);1790 if(pEntry && pEntry->IsPantheonBelief())1791 {1792#if defined(MOD_EVENTS_ACQUIRE_BELIEFS)1793 bool bAvailable = true;17941795 if (MOD_EVENTS_ACQUIRE_BELIEFS) {1796 if (GAMEEVENTINVOKE_TESTALL(GAMEEVENT_PlayerCanHaveBelief, ePlayer, eBelief) == GAMEEVENTRETURN_FALSE) {1797 bAvailable = false;1798 }1799 }18001801 if (bAvailable) {1802#endif1803 availableBeliefs.push_back(eBelief);1804#if defined(MOD_EVENTS_ACQUIRE_BELIEFS)1805 }1806#endif1807 }1808 }1809 }18101811 return availableBeliefs;1812}
Calls
- CustomMods::eventTestAll(const char *, const char *, ...)
- CustomMods::isEVENTS_ACQUIRE_BELIEFS()
- CvBeliefEntry::IsPantheonBelief() const
- CvBeliefXMLEntries::GetEntry(int)
- CvBeliefXMLEntries::GetNumBeliefs()
- CvGameReligions::IsInSomeReligion(BeliefTypes, PlayerTypes) const
- CvGlobals::GetGameBeliefs() const
std::vector::push_backstd::vector::reservestd::vector::vectorstd::vector::vector