Bazaar developer reference

CvMinorCivAI::GetMostFriendshipWithAnyMajor(PlayerTypes &)

Defined in
CvMinorCivAI.cpp, line 6481
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_GetMostFriendshipWithAnyMajor

Hooks

static bool BeforeCvMinorCivAI_GetMostFriendshipWithAnyMajor(CvMinorCivAI* self, PlayerTypes& eBestPlayer, int& result);static void AfterCvMinorCivAI_GetMostFriendshipWithAnyMajor(CvMinorCivAI* self, PlayerTypes& eBestPlayer, int& result);static int ReplaceCvMinorCivAI_GetMostFriendshipWithAnyMajor(int (*original)(CvMinorCivAI*, PlayerTypes&), CvMinorCivAI* self, PlayerTypes& eBestPlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_GetMostFriendshipWithAnyMajor>(host, &BeforeCvMinorCivAI_GetMostFriendshipWithAnyMajor);CivRegisterAfter<CivHooks::CvMinorCivAI_GetMostFriendshipWithAnyMajor>(host, &AfterCvMinorCivAI_GetMostFriendshipWithAnyMajor);CivRegisterReplace<CivHooks::CvMinorCivAI_GetMostFriendshipWithAnyMajor>(host, &ReplaceCvMinorCivAI_GetMostFriendshipWithAnyMajor);

Code

6480/// The most Friendship (effective, not base) any player has with this Minor6481int CvMinorCivAI::GetMostFriendshipWithAnyMajor(PlayerTypes& eBestPlayer)6482{6483	int iMostFriendship = 0;6484	PlayerTypes eMajor;64856486	int iFriendship;64876488	for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)6489	{6490		eMajor = (PlayerTypes) iMajorLoop;64916492		if(IsHasMetPlayer(eMajor))6493		{6494			iFriendship = GetEffectiveFriendshipWithMajor(eMajor);64956496			if(iFriendship > iMostFriendship)6497			{6498				eBestPlayer = eMajor;6499				iMostFriendship = iFriendship;6500			}6501		}6502	}65036504	return iMostFriendship;6505}

Calls