Bazaar developer reference

CvDiplomacyAI::DoUpdateOnePlayerMilitaryStrength(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 6597
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength

Hooks

static bool BeforeCvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength(CvDiplomacyAI* self, PlayerTypes ePlayer);static void AfterCvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength(CvDiplomacyAI* self, PlayerTypes ePlayer);static void ReplaceCvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength(void (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength>(host, &BeforeCvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength>(host, &AfterCvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength>(host, &ReplaceCvDiplomacyAI_DoUpdateOnePlayerMilitaryStrength);

Code

6596/// Updates what our assessment is of all players' overall military strength6597void CvDiplomacyAI::DoUpdateOnePlayerMilitaryStrength(PlayerTypes ePlayer)6598{6599	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");6600	CvAssertMsg(ePlayer < MAX_CIV_PLAYERS, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");66016602	StrengthTypes eMilitaryStrength;66036604	int iBase = /*30*/ GC.getMILITARY_STRENGTH_BASE();6605	int iMilitaryStrength = iBase + GetPlayer()->GetMilitaryMight();66066607	int iOtherPlayerMilitary;6608	int iMilitaryRatio;66096610	if(IsPlayerValid(ePlayer, /*bMyTeamIsValid*/ true))6611	{6612		// Look at player's Military Strength6613		//if (GetPlayer()->GetMilitaryMight() > 0)6614		{6615			iOtherPlayerMilitary = GET_PLAYER(ePlayer).GetMilitaryMight() + iBase;6616			// Example: If another player has double the Military strength of us, the Ratio will be 2006617			iMilitaryRatio = iOtherPlayerMilitary* /*100*/ GC.getMILITARY_STRENGTH_RATIO_MULTIPLIER() / iMilitaryStrength;6618		}6619		//else6620		//{6621		//	iMilitaryRatio = /*100*/ GC.getMILITARY_STRENGTH_RATIO_MULTIPLIER();6622		//}66236624		//iMilitaryStrength += iMilitaryRatio;66256626		// Now do the final assessment6627		if(iMilitaryRatio >= /*250*/ GC.getMILITARY_STRENGTH_IMMENSE_THRESHOLD())6628			eMilitaryStrength = STRENGTH_IMMENSE;6629		else if(iMilitaryRatio >= /*165*/ GC.getMILITARY_STRENGTH_POWERFUL_THRESHOLD())6630			eMilitaryStrength = STRENGTH_POWERFUL;6631		else if(iMilitaryRatio >= /*115*/ GC.getMILITARY_STRENGTH_STRONG_THRESHOLD())6632			eMilitaryStrength = STRENGTH_STRONG;6633		else if(iMilitaryRatio >= /*85*/ GC.getMILITARY_STRENGTH_AVERAGE_THRESHOLD())6634			eMilitaryStrength = STRENGTH_AVERAGE;6635		else if(iMilitaryRatio >= /*60*/ GC.getMILITARY_STRENGTH_POOR_THRESHOLD())6636			eMilitaryStrength = STRENGTH_POOR;6637		else if(iMilitaryRatio >= /*40*/ GC.getMILITARY_STRENGTH_WEAK_THRESHOLD())6638			eMilitaryStrength = STRENGTH_WEAK;6639		else6640			eMilitaryStrength = STRENGTH_PATHETIC;66416642		// Set the value6643		SetPlayerMilitaryStrengthComparedToUs(ePlayer, eMilitaryStrength);6644	}6645}

Calls

Called by