CvDiplomacyAI::GetRecentAssistScore(PlayerTypes)
- Defined in
- CvDiplomacyAI.cpp, line 24046
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_GetRecentAssistScore
Hooks
static bool BeforeCvDiplomacyAI_GetRecentAssistScore(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static void AfterCvDiplomacyAI_GetRecentAssistScore(CvDiplomacyAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvDiplomacyAI_GetRecentAssistScore(int (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_GetRecentAssistScore>(host, &BeforeCvDiplomacyAI_GetRecentAssistScore);CivRegisterAfter<CivHooks::CvDiplomacyAI_GetRecentAssistScore>(host, &AfterCvDiplomacyAI_GetRecentAssistScore);CivRegisterReplace<CivHooks::CvDiplomacyAI_GetRecentAssistScore>(host, &ReplaceCvDiplomacyAI_GetRecentAssistScore);
Code
24046int CvDiplomacyAI::GetRecentAssistScore(PlayerTypes ePlayer)24047{24048 int iOpinionWeight = 0;24049 if(GetRecentAssistValue(ePlayer) != 0)24050 {24051 int iWeightChange = GetRecentAssistValue(ePlayer) / GC.getDEAL_VALUE_PER_OPINION_WEIGHT();24052 if (iWeightChange < -GC.getOPINION_WEIGHT_ASSIST_MAX())24053 {24054 iWeightChange = -GC.getOPINION_WEIGHT_ASSIST_MAX();24055 }24056 else if (iWeightChange > GC.getOPINION_WEIGHT_ASSIST_MAX())24057 {24058 iWeightChange = GC.getOPINION_WEIGHT_ASSIST_MAX();24059 }24060 iOpinionWeight += iWeightChange;24061 }24062 return iOpinionWeight;24063}