Bazaar developer reference

CvDiplomacyAI::ChangeRecentAssistValue(PlayerTypes, int)

Defined in
CvDiplomacyAI.cpp, line 8033
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_ChangeRecentAssistValue

Hooks

static bool BeforeCvDiplomacyAI_ChangeRecentAssistValue(CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);static void AfterCvDiplomacyAI_ChangeRecentAssistValue(CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);static void ReplaceCvDiplomacyAI_ChangeRecentAssistValue(void (*original)(CvDiplomacyAI*, PlayerTypes, int), CvDiplomacyAI* self, PlayerTypes ePlayer, int iChange);CivRegisterBefore<CivHooks::CvDiplomacyAI_ChangeRecentAssistValue>(host, &BeforeCvDiplomacyAI_ChangeRecentAssistValue);CivRegisterAfter<CivHooks::CvDiplomacyAI_ChangeRecentAssistValue>(host, &AfterCvDiplomacyAI_ChangeRecentAssistValue);CivRegisterReplace<CivHooks::CvDiplomacyAI_ChangeRecentAssistValue>(host, &ReplaceCvDiplomacyAI_ChangeRecentAssistValue);

Code

8032/// Set value of aid given8033void CvDiplomacyAI::ChangeRecentAssistValue(PlayerTypes ePlayer, int iChange)8034{8035	if(iChange != 0)8036	{8037		CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");8038		CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.");80398040		m_paiAssistValue[ePlayer] += iChange;8041		short iMaxOpinionValue = GC.getDEAL_VALUE_PER_OPINION_WEIGHT() * GC.getOPINION_WEIGHT_ASSIST_MAX();80428043		if (m_paiAssistValue[ePlayer] < -iMaxOpinionValue)8044		{8045			m_paiAssistValue[ePlayer] = -iMaxOpinionValue;8046		}8047		else if (m_paiAssistValue[ePlayer] > iMaxOpinionValue)8048		{8049			m_paiAssistValue[ePlayer] = iMaxOpinionValue;8050		}8051	}8052}

Calls

Called by