CvGameReligions::GetNumFollowers(ReligionTypes) const
- Defined in
- CvReligionClasses.cpp, line 1839
- Class
- CvGameReligions
- Hook name
CivHooks::CvGameReligions_GetNumFollowers
Hooks
static bool BeforeCvGameReligions_GetNumFollowers(const CvGameReligions* self, ReligionTypes eReligion, int& result);static void AfterCvGameReligions_GetNumFollowers(const CvGameReligions* self, ReligionTypes eReligion, int& result);static int ReplaceCvGameReligions_GetNumFollowers(int (*original)(const CvGameReligions*, ReligionTypes), const CvGameReligions* self, ReligionTypes eReligion);CivRegisterBefore<CivHooks::CvGameReligions_GetNumFollowers>(host, &BeforeCvGameReligions_GetNumFollowers);CivRegisterAfter<CivHooks::CvGameReligions_GetNumFollowers>(host, &AfterCvGameReligions_GetNumFollowers);CivRegisterReplace<CivHooks::CvGameReligions_GetNumFollowers>(host, &ReplaceCvGameReligions_GetNumFollowers);
Code
1838/// Number of followers of this religion1839int CvGameReligions::GetNumFollowers(ReligionTypes eReligion) const1840{1841 int iRtnValue = 0;18421843 // Loop through all the players1844 for(int iI = 0; iI < MAX_PLAYERS; iI++)1845 {1846 CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);1847 if(kPlayer.isAlive())1848 {1849 // Loop through each of their cities1850 int iLoop;1851 CvCity* pLoopCity;1852 for(pLoopCity = kPlayer.firstCity(&iLoop); pLoopCity != NULL; pLoopCity = kPlayer.nextCity(&iLoop))1853 {1854 iRtnValue += pLoopCity->GetCityReligions()->GetNumFollowers(eReligion);1855 }1856 }1857 }1858 return iRtnValue;1859}