CvGameReligions::GetNumCitiesFollowing(ReligionTypes) const
- Defined in
- CvReligionClasses.cpp, line 1862
- Class
- CvGameReligions
- Hook name
CivHooks::CvGameReligions_GetNumCitiesFollowing
Hooks
static bool BeforeCvGameReligions_GetNumCitiesFollowing(const CvGameReligions* self, ReligionTypes eReligion, int& result);static void AfterCvGameReligions_GetNumCitiesFollowing(const CvGameReligions* self, ReligionTypes eReligion, int& result);static int ReplaceCvGameReligions_GetNumCitiesFollowing(int (*original)(const CvGameReligions*, ReligionTypes), const CvGameReligions* self, ReligionTypes eReligion);CivRegisterBefore<CivHooks::CvGameReligions_GetNumCitiesFollowing>(host, &BeforeCvGameReligions_GetNumCitiesFollowing);CivRegisterAfter<CivHooks::CvGameReligions_GetNumCitiesFollowing>(host, &AfterCvGameReligions_GetNumCitiesFollowing);CivRegisterReplace<CivHooks::CvGameReligions_GetNumCitiesFollowing>(host, &ReplaceCvGameReligions_GetNumCitiesFollowing);
Code
1861/// Number of cities following this religion1862int CvGameReligions::GetNumCitiesFollowing(ReligionTypes eReligion) const1863{1864 int iRtnValue = 0;18651866 // Loop through all the players1867 for(int iI = 0; iI < MAX_PLAYERS; iI++)1868 {1869 CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);1870 if(kPlayer.isAlive())1871 {1872 // Loop through each of their cities1873 int iLoop;1874 CvCity* pLoopCity;1875 for(pLoopCity = kPlayer.firstCity(&iLoop); pLoopCity != NULL; pLoopCity = kPlayer.nextCity(&iLoop))1876 {1877 if(pLoopCity->GetCityReligions()->GetReligiousMajority() == eReligion)1878 {1879 iRtnValue++;1880 }1881 }1882 }1883 }1884 return iRtnValue;1885}