Bazaar developer reference

CvDiplomacyAI::DoUpdateOnePlayerEconomicStrength(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 6679
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoUpdateOnePlayerEconomicStrength

Hooks

static bool BeforeCvDiplomacyAI_DoUpdateOnePlayerEconomicStrength(CvDiplomacyAI* self, PlayerTypes ePlayer);static void AfterCvDiplomacyAI_DoUpdateOnePlayerEconomicStrength(CvDiplomacyAI* self, PlayerTypes ePlayer);static void ReplaceCvDiplomacyAI_DoUpdateOnePlayerEconomicStrength(void (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoUpdateOnePlayerEconomicStrength>(host, &BeforeCvDiplomacyAI_DoUpdateOnePlayerEconomicStrength);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoUpdateOnePlayerEconomicStrength>(host, &AfterCvDiplomacyAI_DoUpdateOnePlayerEconomicStrength);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoUpdateOnePlayerEconomicStrength>(host, &ReplaceCvDiplomacyAI_DoUpdateOnePlayerEconomicStrength);

Code

6679void CvDiplomacyAI::DoUpdateOnePlayerEconomicStrength(PlayerTypes ePlayer)6680{6681	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");6682	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.");66836684	int iEconomicStrength;6685	StrengthTypes eEconomicStrength;66866687	int iOtherPlayerEconomy;6688	int iEconomicRatio;66896690	if(IsPlayerValid(ePlayer, /*bMyTeamIsValid*/ true))6691	{6692		iEconomicStrength = 0;66936694		// Look at player's Economic Strength6695		if(GetPlayer()->GetEconomicMight() > 0)6696		{6697			iOtherPlayerEconomy = GET_PLAYER(ePlayer).GetEconomicMight();6698			// Example: If another player has double the Economic strength of us, the Ratio will be 2006699			iEconomicRatio = iOtherPlayerEconomy* /*100*/ GC.getECONOMIC_STRENGTH_RATIO_MULTIPLIER() / GetPlayer()->GetEconomicMight();6700		}6701		else6702		{6703			iEconomicRatio = /*100*/ GC.getECONOMIC_STRENGTH_RATIO_MULTIPLIER() * 5;6704		}67056706		iEconomicStrength += iEconomicRatio;67076708		// Now do the final assessment6709		if(iEconomicStrength >= /*250*/ GC.getECONOMIC_STRENGTH_IMMENSE_THRESHOLD())6710			eEconomicStrength = STRENGTH_IMMENSE;6711		else if(iEconomicStrength >= /*153*/ GC.getECONOMIC_STRENGTH_POWERFUL_THRESHOLD())6712			eEconomicStrength = STRENGTH_POWERFUL;6713		else if(iEconomicStrength >= /*120*/ GC.getECONOMIC_STRENGTH_STRONG_THRESHOLD())6714			eEconomicStrength = STRENGTH_STRONG;6715		else if(iEconomicStrength >= /*83*/ GC.getECONOMIC_STRENGTH_AVERAGE_THRESHOLD())6716			eEconomicStrength = STRENGTH_AVERAGE;6717		else if(iEconomicStrength >= /*65*/ GC.getECONOMIC_STRENGTH_POOR_THRESHOLD())6718			eEconomicStrength = STRENGTH_POOR;6719		else if(iEconomicStrength >= /*40*/ GC.getECONOMIC_STRENGTH_WEAK_THRESHOLD())6720			eEconomicStrength = STRENGTH_WEAK;6721		else6722			eEconomicStrength = STRENGTH_PATHETIC;67236724		// Set the value6725		SetPlayerEconomicStrengthComparedToUs(ePlayer, eEconomicStrength);6726	}6727}

Calls

Called by