Hooks
static bool BeforeCvDiplomacyAI_LogMinorCivBuyout(CvDiplomacyAI* self, PlayerTypes eMinor, int iGoldPaid, bool bSaving);static void AfterCvDiplomacyAI_LogMinorCivBuyout(CvDiplomacyAI* self, PlayerTypes eMinor, int iGoldPaid, bool bSaving);static void ReplaceCvDiplomacyAI_LogMinorCivBuyout(void (*original)(CvDiplomacyAI*, PlayerTypes, int, bool), CvDiplomacyAI* self, PlayerTypes eMinor, int iGoldPaid, bool bSaving);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogMinorCivBuyout>(host, &BeforeCvDiplomacyAI_LogMinorCivBuyout);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogMinorCivBuyout>(host, &AfterCvDiplomacyAI_LogMinorCivBuyout);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogMinorCivBuyout>(host, &ReplaceCvDiplomacyAI_LogMinorCivBuyout);
Code
25027/// A minor civ was bought, and possession changed25028void CvDiplomacyAI::LogMinorCivBuyout(PlayerTypes eMinor, int iGoldPaid, bool bSaving)25029{25030 if(GC.getLogging() && GC.getAILogging())25031 {25032 CvString strLogName;2503325034 CvString strOutBuf;25035 CvString strBaseString;2503625037 CvString playerName;25038 CvString otherPlayerName;2503925040 CvString strTemp;2504125042 playerName = GetPlayer()->getCivilizationShortDescription();2504325044 // Open the log file25045 if(GC.getPlayerAndCityAILogSplit())25046 strLogName = "DiplomacyAI_MinorCiv_Log_" + playerName + ".csv";25047 else25048 strLogName = "DiplomacyAI_MinorCiv_Log.csv";2504925050 FILogFile* pLog;25051 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2505225053 // Turn number25054 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2505525056 // Our Name25057 strBaseString += playerName;2505825059 // Their Name25060 otherPlayerName = GET_PLAYER(eMinor).getCivilizationShortDescription();25061 strBaseString += ", " + otherPlayerName;2506225063 strOutBuf = strBaseString;2506425065 strTemp.Format("BUYOUT: %d", iGoldPaid);25066 strOutBuf += ", " + strTemp;2506725068 // Spacing25069 strOutBuf += ", , ";2507025071 // City State type25072 strOutBuf += ", ";25073 strOutBuf += GC.getMinorCivInfo(GET_PLAYER(eMinor).GetMinorCivAI()->GetMinorCivType())->GetType();2507425075 // Saving Gold for Gift25076 if(bSaving)25077 strOutBuf += ", (SAVING) ";2507825079 pLog->Msg(strOutBuf);2508025081 OutputDebugString("\n");25082 OutputDebugString(strOutBuf);25083 OutputDebugString("\n");25084 }25085}