Bazaar developer reference

CvDiplomacyAI::GetCommonFoeScore(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 24031
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_GetCommonFoeScore

Hooks

static bool BeforeCvDiplomacyAI_GetCommonFoeScore(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static void AfterCvDiplomacyAI_GetCommonFoeScore(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvDiplomacyAI_GetCommonFoeScore(int (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_GetCommonFoeScore>(host, &BeforeCvDiplomacyAI_GetCommonFoeScore);CivRegisterAfter<CivHooks::CvDiplomacyAI_GetCommonFoeScore>(host, &AfterCvDiplomacyAI_GetCommonFoeScore);CivRegisterReplace<CivHooks::CvDiplomacyAI_GetCommonFoeScore>(host, &ReplaceCvDiplomacyAI_GetCommonFoeScore);

Code

24031int CvDiplomacyAI::GetCommonFoeScore(PlayerTypes ePlayer)24032{24033	int iOpinionWeight = 0;24034	if(GetCommonFoeValue(ePlayer) > 0)24035	{24036		int iWeightChange = -1 * GetCommonFoeValue(ePlayer) / GC.getCOMMON_FOE_VALUE_PER_OPINION_WEIGHT();24037		if(iWeightChange < /*-50*/ GC.getOPINION_WEIGHT_COMMON_FOE_MAX())24038		{24039			iWeightChange = GC.getOPINION_WEIGHT_COMMON_FOE_MAX();24040		}24041		iOpinionWeight +=  iWeightChange;24042	}	24043	return iOpinionWeight;24044}

Calls

Called by