Bazaar developer reference

CvDiplomacyAI::GetGlobalCoopWarCounter(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 20651
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_GetGlobalCoopWarCounter

Hooks

static bool BeforeCvDiplomacyAI_GetGlobalCoopWarCounter(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static void AfterCvDiplomacyAI_GetGlobalCoopWarCounter(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvDiplomacyAI_GetGlobalCoopWarCounter(int (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_GetGlobalCoopWarCounter>(host, &BeforeCvDiplomacyAI_GetGlobalCoopWarCounter);CivRegisterAfter<CivHooks::CvDiplomacyAI_GetGlobalCoopWarCounter>(host, &AfterCvDiplomacyAI_GetGlobalCoopWarCounter);CivRegisterReplace<CivHooks::CvDiplomacyAI_GetGlobalCoopWarCounter>(host, &ReplaceCvDiplomacyAI_GetGlobalCoopWarCounter);

Code

20650/// What is the SHORTEST amount of time on any coop counter?20651int CvDiplomacyAI::GetGlobalCoopWarCounter(PlayerTypes ePlayer)20652{20653	int iBestCount = MAX_TURNS_SAFE_ESTIMATE;2065420655	int iTempCount;2065620657	PlayerTypes eLoopPlayer;20658	for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)20659	{20660		eLoopPlayer = (PlayerTypes) iPlayerLoop;2066120662		if(IsPlayerValid(eLoopPlayer))20663		{20664			iTempCount = GetCoopWarCounter(eLoopPlayer, ePlayer);2066520666			// No valid count against this guy20667			if(iTempCount < 0)20668				continue;2066920670			if(iTempCount < iBestCount)20671				iBestCount = iTempCount;20672		}20673	}2067420675	return iBestCount;20676}

Calls

Called by