Bazaar developer reference

CvMinorCivAI::ResetFriendshipWithMajor(PlayerTypes)

Defined in
CvMinorCivAI.cpp, line 6383
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_ResetFriendshipWithMajor

Hooks

static bool BeforeCvMinorCivAI_ResetFriendshipWithMajor(CvMinorCivAI* self, PlayerTypes ePlayer);static void AfterCvMinorCivAI_ResetFriendshipWithMajor(CvMinorCivAI* self, PlayerTypes ePlayer);static void ReplaceCvMinorCivAI_ResetFriendshipWithMajor(void (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_ResetFriendshipWithMajor>(host, &BeforeCvMinorCivAI_ResetFriendshipWithMajor);CivRegisterAfter<CivHooks::CvMinorCivAI_ResetFriendshipWithMajor>(host, &AfterCvMinorCivAI_ResetFriendshipWithMajor);CivRegisterReplace<CivHooks::CvMinorCivAI_ResetFriendshipWithMajor>(host, &ReplaceCvMinorCivAI_ResetFriendshipWithMajor);

Code

6382/// Resets the base level of Friendship to zero6383void CvMinorCivAI::ResetFriendshipWithMajor(PlayerTypes ePlayer)6384{6385	// If ePlayer isn't a major civ then there is no influence value to reset, so just return6386	if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return; // as defined during Reset()63876388	int iOldFriendship = GetEffectiveFriendshipWithMajor(ePlayer);6389	const int iResetFriendship = 0;6390	if(GetPlayer()->isAlive())6391	{6392		SetFriendshipWithMajor(ePlayer, iResetFriendship);6393	}6394	else6395	{6396		// special workaround to allow status changes despite minor already being dead6397		DoFriendshipChangeEffects(ePlayer, iOldFriendship, iResetFriendship, /*bFromQuest*/false, /*bIgnoreMinorDeath*/true);6398		SetFriendshipWithMajor(ePlayer, iResetFriendship);6399	}64006401}

Calls

Called by