Bazaar developer reference

CvPlayerReligions::HasOthersReligionInMostCities(PlayerTypes) const

Defined in
CvReligionClasses.cpp, line 3174
Class
CvPlayerReligions
Hook name
CivHooks::CvPlayerReligions_HasOthersReligionInMostCities

Hooks

static bool BeforeCvPlayerReligions_HasOthersReligionInMostCities(const CvPlayerReligions* self, PlayerTypes eOtherPlayer, bool& result);static void AfterCvPlayerReligions_HasOthersReligionInMostCities(const CvPlayerReligions* self, PlayerTypes eOtherPlayer, bool& result);static bool ReplaceCvPlayerReligions_HasOthersReligionInMostCities(bool (*original)(const CvPlayerReligions*, PlayerTypes), const CvPlayerReligions* self, PlayerTypes eOtherPlayer);CivRegisterBefore<CivHooks::CvPlayerReligions_HasOthersReligionInMostCities>(host, &BeforeCvPlayerReligions_HasOthersReligionInMostCities);CivRegisterAfter<CivHooks::CvPlayerReligions_HasOthersReligionInMostCities>(host, &AfterCvPlayerReligions_HasOthersReligionInMostCities);CivRegisterReplace<CivHooks::CvPlayerReligions_HasOthersReligionInMostCities>(host, &ReplaceCvPlayerReligions_HasOthersReligionInMostCities);

Code

3173/// Is this player happily following this other player's religion?3174bool CvPlayerReligions::HasOthersReligionInMostCities(PlayerTypes eOtherPlayer) const3175{3176	// Not happy about it if have their own religion3177	if(HasCreatedReligion())3178	{3179		return false;3180	}31813182	ReligionTypes eOtherReligion = GC.getGame().GetGameReligions()->GetReligionCreatedByPlayer(eOtherPlayer);31833184	if(eOtherReligion <= RELIGION_PANTHEON)3185	{3186		return false;3187	}31883189	int iNumFollowingCities = 0;3190	int iLoop = 0;3191	CvCity* pCity = NULL;3192	for(pCity = m_pPlayer->firstCity(&iLoop); pCity != NULL; pCity = m_pPlayer->nextCity(&iLoop))3193	{3194		if(pCity)3195		{3196			if(pCity->GetCityReligions()->GetReligiousMajority() == eOtherReligion)3197			{3198				iNumFollowingCities++;3199			}3200		}3201	}32023203	// Over half?3204	return (iNumFollowingCities * 2 > m_pPlayer->getNumCities());3205}

Calls

Called by