Hooks
static bool BeforeCvDiplomacyAI_LogMinorCivApproachUpdate(CvDiplomacyAI* self, PlayerTypes ePlayer, const int* aiApproachValues, MinorCivApproachTypes eNewMinorCivApproach, MinorCivApproachTypes eOldApproach);static void AfterCvDiplomacyAI_LogMinorCivApproachUpdate(CvDiplomacyAI* self, PlayerTypes ePlayer, const int* aiApproachValues, MinorCivApproachTypes eNewMinorCivApproach, MinorCivApproachTypes eOldApproach);static void ReplaceCvDiplomacyAI_LogMinorCivApproachUpdate(void (*original)(CvDiplomacyAI*, PlayerTypes, const int*, MinorCivApproachTypes, MinorCivApproachTypes), CvDiplomacyAI* self, PlayerTypes ePlayer, const int* aiApproachValues, MinorCivApproachTypes eNewMinorCivApproach, MinorCivApproachTypes eOldApproach);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogMinorCivApproachUpdate>(host, &BeforeCvDiplomacyAI_LogMinorCivApproachUpdate);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogMinorCivApproachUpdate>(host, &AfterCvDiplomacyAI_LogMinorCivApproachUpdate);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogMinorCivApproachUpdate>(host, &ReplaceCvDiplomacyAI_LogMinorCivApproachUpdate);
Code
26030/// Log Minor Civ Approach Update26031void CvDiplomacyAI::LogMinorCivApproachUpdate(PlayerTypes ePlayer, const int* aiApproachValues, MinorCivApproachTypes eNewMinorCivApproach, MinorCivApproachTypes eOldApproach)26032{26033 if(GC.getLogging() && GC.getAILogging())26034 {26035 CvString strOutBuf;26036 CvString strBaseString;26037 CvString strTemp;26038 CvString playerName;26039 CvString otherPlayerName;26040 CvString strDesc;26041 CvString strLogName;2604226043 // Find the name of this civ and city26044 playerName = GetPlayer()->getCivilizationShortDescription();2604526046 // Open the log file26047 if(GC.getPlayerAndCityAILogSplit())26048 {26049 strLogName = "DiplomacyAI_Approach_Log_" + playerName + ".csv";26050 }26051 else26052 {26053 strLogName = "DiplomacyAI_Approach_Log.csv";26054 }2605526056 FILogFile* pLog;26057 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2605826059 // Get the leading info for this line26060 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2606126062 // Name26063 strBaseString += playerName;2606426065 otherPlayerName = GET_PLAYER(ePlayer).getCivilizationShortDescription();26066 strBaseString += ", --- " + otherPlayerName;2606726068 MinorCivApproachTypes eMinorCivApproach;2606926070 // Minor Civs only26071 if(GET_PLAYER(ePlayer).isMinorCiv())26072 {26073 LogMinorCivApproach(strOutBuf, eNewMinorCivApproach);2607426075 if(eNewMinorCivApproach != eOldApproach)26076 {26077 LogMinorCivApproach(strOutBuf, eOldApproach);26078 }26079 else26080 {26081 strTemp.Format("---");26082 strOutBuf += ", " + strTemp;26083 }2608426085 //LogOpinion(strOutBuf, ePlayer);26086 strOutBuf += ", ";2608726088 //LogWarmongerThreat(strOutBuf, ePlayer);26089 strOutBuf += ", ";2609026091 //LogMilitaryThreat(strOutBuf, ePlayer);26092 strOutBuf += ", ";2609326094 LogTargetValue(strOutBuf, ePlayer);2609526096 LogWarGoal(strOutBuf, ePlayer);2609726098 LogMilitaryAggressivePosture(strOutBuf, ePlayer);2609926100 LogProximity(strOutBuf, ePlayer);2610126102 LogLandDispute(strOutBuf, ePlayer);2610326104 //LogVictoryDispute(strOutBuf, ePlayer);26105 strOutBuf += ", ";2610626107 strOutBuf += ", ---";2610826109 // Weights for each possible Approach26110 for(int iMinorCivApproachLoop = 0; iMinorCivApproachLoop < NUM_MINOR_CIV_APPROACHES; iMinorCivApproachLoop++)26111 {26112 eMinorCivApproach = (MinorCivApproachTypes) iMinorCivApproachLoop;2611326114 switch(eMinorCivApproach)26115 {26116 case MINOR_CIV_APPROACH_IGNORE:26117 strTemp.Format("Ignore");26118 break;26119 case MINOR_CIV_APPROACH_FRIENDLY:26120 strTemp.Format("Friendly");26121 break;26122 case MINOR_CIV_APPROACH_PROTECTIVE:26123 strTemp.Format("Protective");26124 break;26125 case MINOR_CIV_APPROACH_CONQUEST:26126 strTemp.Format("Conquest");26127 break;26128 case MINOR_CIV_APPROACH_BULLY:26129 strTemp.Format("Bully");26130 break;26131 default:26132 strTemp.Format("XXX");26133 break;26134 }26135 strOutBuf += ", " + strTemp;2613626137 strTemp.Format("%d", aiApproachValues[eMinorCivApproach] / 100);26138 strOutBuf += ", " + strTemp;26139 }2614026141 strOutBuf = strBaseString + strOutBuf;26142 pLog->Msg(strOutBuf);26143 }26144 }26145}