CvReligionAI::AreAllOurCitiesHaveFaithBuilding(ReligionTypes, bool) const
- Defined in
- CvReligionClasses.cpp, line 6862
- Class
- CvReligionAI
- Hook name
CivHooks::CvReligionAI_AreAllOurCitiesHaveFaithBuilding
Hooks
static bool BeforeCvReligionAI_AreAllOurCitiesHaveFaithBuilding(const CvReligionAI* self, ReligionTypes eReligion, bool bIncludePuppets, bool& result);static void AfterCvReligionAI_AreAllOurCitiesHaveFaithBuilding(const CvReligionAI* self, ReligionTypes eReligion, bool bIncludePuppets, bool& result);static bool ReplaceCvReligionAI_AreAllOurCitiesHaveFaithBuilding(bool (*original)(const CvReligionAI*, ReligionTypes, bool), const CvReligionAI* self, ReligionTypes eReligion, bool bIncludePuppets);CivRegisterBefore<CivHooks::CvReligionAI_AreAllOurCitiesHaveFaithBuilding>(host, &BeforeCvReligionAI_AreAllOurCitiesHaveFaithBuilding);CivRegisterAfter<CivHooks::CvReligionAI_AreAllOurCitiesHaveFaithBuilding>(host, &AfterCvReligionAI_AreAllOurCitiesHaveFaithBuilding);CivRegisterReplace<CivHooks::CvReligionAI_AreAllOurCitiesHaveFaithBuilding>(host, &ReplaceCvReligionAI_AreAllOurCitiesHaveFaithBuilding);
Code
6861/// Do all of our own cities have this religion's faith building if possible?6862bool CvReligionAI::AreAllOurCitiesHaveFaithBuilding(ReligionTypes eReligion, bool bIncludePuppets) const6863{6864 bool bRtnValue = true;6865 BuildingClassTypes eFaithBuildingClass = FaithBuildingAvailable(eReligion);6866 BuildingTypes eFaithBuilding = (BuildingTypes)m_pPlayer->getCivilizationInfo().getCivilizationBuildings(eFaithBuildingClass);68676868 if(eFaithBuildingClass == NO_BUILDINGCLASS || eFaithBuilding == NO_BUILDING)6869 {6870 return true;6871 }68726873 int iLoop;6874 CvCity* pLoopCity;6875 for(pLoopCity = m_pPlayer->firstCity(&iLoop); pLoopCity != NULL; pLoopCity = m_pPlayer->nextCity(&iLoop))6876 {6877 if(pLoopCity->GetCityReligions()->GetReligiousMajority() == eReligion)6878 {6879 if(bIncludePuppets || !pLoopCity->IsPuppet())6880 {6881 if(pLoopCity->GetCityBuildings()->GetNumBuilding(eFaithBuilding) < 1)6882 {6883 bRtnValue = false;6884 break;6885 }6886 }6887 }6888 }68896890 return bRtnValue;6891}
Calls
- CvCity::GetCityBuildings() const
- CvCity::GetCityReligions() const
- CvCity::IsPuppet() const
- CvCityBuildings::GetNumBuilding(BuildingTypes) const
- CvCityReligions::GetReligiousMajority()
- CvCivilizationInfo::getCivilizationBuildings(int) const
- CvPlayer::firstCity(int *, bool)
- CvPlayer::getCivilizationInfo() const
- CvPlayer::nextCity(int *, bool)
- CvReligionAI::FaithBuildingAvailable(ReligionTypes) const