Bazaar developer reference

CvDiplomacyAI::ChangeCommonFoeValue(PlayerTypes, int)

Defined in
CvDiplomacyAI.cpp, line 8005
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_ChangeCommonFoeValue

Hooks

static bool BeforeCvDiplomacyAI_ChangeCommonFoeValue(CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);static void AfterCvDiplomacyAI_ChangeCommonFoeValue(CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);static void ReplaceCvDiplomacyAI_ChangeCommonFoeValue(void (*original)(CvDiplomacyAI*, PlayerTypes, int), CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);CivRegisterBefore<CivHooks::CvDiplomacyAI_ChangeCommonFoeValue>(host, &BeforeCvDiplomacyAI_ChangeCommonFoeValue);CivRegisterAfter<CivHooks::CvDiplomacyAI_ChangeCommonFoeValue>(host, &AfterCvDiplomacyAI_ChangeCommonFoeValue);CivRegisterReplace<CivHooks::CvDiplomacyAI_ChangeCommonFoeValue>(host, &ReplaceCvDiplomacyAI_ChangeCommonFoeValue);

Code

8004/// Set value of combat damage inflicted on a common enemy8005void CvDiplomacyAI::ChangeCommonFoeValue(PlayerTypes ePlayer, int iChange)8006{8007	if(iChange != 0 && ePlayer < MAX_MAJOR_CIVS)8008	{8009		CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");80108011		m_paiCommonFoeValue[ePlayer] += iChange;8012		short iMaxOpinionValue = GC.getCOMMON_FOE_VALUE_PER_OPINION_WEIGHT() * -(GC.getOPINION_WEIGHT_COMMON_FOE_MAX());80138014		// Must be between 0 and maximum possible boost to opinion8015		if(m_paiCommonFoeValue[ePlayer] < 0)8016		{8017			m_paiCommonFoeValue[ePlayer] = 0;8018		}8019		else if(m_paiCommonFoeValue[ePlayer] > iMaxOpinionValue)8020		{8021			m_paiCommonFoeValue[ePlayer] = iMaxOpinionValue;8022		}8023	}8024}

Calls

Called by