Bazaar developer reference

CvPlayerReligions::GetNumForeignCitiesFollowing() const

Defined in
CvReligionClasses.cpp, line 3302
Class
CvPlayerReligions
Hook name
CivHooks::CvPlayerReligions_GetNumForeignCitiesFollowing

Hooks

static bool BeforeCvPlayerReligions_GetNumForeignCitiesFollowing(const CvPlayerReligions* self, int& result);static void AfterCvPlayerReligions_GetNumForeignCitiesFollowing(const CvPlayerReligions* self, int& result);static int ReplaceCvPlayerReligions_GetNumForeignCitiesFollowing(int (*original)(const CvPlayerReligions*), const CvPlayerReligions* self);CivRegisterBefore<CivHooks::CvPlayerReligions_GetNumForeignCitiesFollowing>(host, &BeforeCvPlayerReligions_GetNumForeignCitiesFollowing);CivRegisterAfter<CivHooks::CvPlayerReligions_GetNumForeignCitiesFollowing>(host, &AfterCvPlayerReligions_GetNumForeignCitiesFollowing);CivRegisterReplace<CivHooks::CvPlayerReligions_GetNumForeignCitiesFollowing>(host, &ReplaceCvPlayerReligions_GetNumForeignCitiesFollowing);

Code

3301/// How many foreign cities are following a religion we founded?3302int CvPlayerReligions::GetNumForeignCitiesFollowing() const3303{3304	CvCity *pLoopCity;3305	int iCityLoop;3306	int iRtnValue = 0;33073308	ReligionTypes eFounderBenefitReligion = GC.getGame().GetGameReligions()->GetFounderBenefitsReligion(m_pPlayer->GetID());3309	if (eFounderBenefitReligion > RELIGION_PANTHEON)3310	{3311		for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)3312		{3313			CvPlayer &kLoopPlayer = GET_PLAYER((PlayerTypes)iPlayerLoop);3314			if(kLoopPlayer.isAlive() && iPlayerLoop != m_pPlayer->GetID())3315			{3316				for(pLoopCity = GET_PLAYER((PlayerTypes)iPlayerLoop).firstCity(&iCityLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)iPlayerLoop).nextCity(&iCityLoop))3317				{3318					if (pLoopCity->GetCityReligions()->GetReligiousMajority() == eFounderBenefitReligion)3319					{3320						iRtnValue++;3321					}3322				}3323			}3324		}3325	}33263327	return iRtnValue;3328}

Calls

Called by