Bazaar developer reference

CvDiplomacyAI::GetRecentTradeScore(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 24016
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_GetRecentTradeScore

Hooks

static bool BeforeCvDiplomacyAI_GetRecentTradeScore(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static void AfterCvDiplomacyAI_GetRecentTradeScore(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvDiplomacyAI_GetRecentTradeScore(int (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_GetRecentTradeScore>(host, &BeforeCvDiplomacyAI_GetRecentTradeScore);CivRegisterAfter<CivHooks::CvDiplomacyAI_GetRecentTradeScore>(host, &AfterCvDiplomacyAI_GetRecentTradeScore);CivRegisterReplace<CivHooks::CvDiplomacyAI_GetRecentTradeScore>(host, &ReplaceCvDiplomacyAI_GetRecentTradeScore);

Code

24016int CvDiplomacyAI::GetRecentTradeScore(PlayerTypes ePlayer)24017{24018	int iOpinionWeight = 0;24019	if(GetRecentTradeValue(ePlayer) > 0)24020	{24021		int iWeightChange = -1 * GetRecentTradeValue(ePlayer) / GC.getDEAL_VALUE_PER_OPINION_WEIGHT();24022		if(iWeightChange < /*-30*/ GC.getOPINION_WEIGHT_TRADE_MAX())24023		{24024			iWeightChange = GC.getOPINION_WEIGHT_TRADE_MAX();24025		}24026		iOpinionWeight +=  iWeightChange;24027	}24028	return iOpinionWeight;24029}

Calls

Called by