Hooks
static bool BeforeCvDiplomacyAI_LogMinorCivBullyGold(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, int iGold, bool bSuccess, int iBullyMetricScore);static void AfterCvDiplomacyAI_LogMinorCivBullyGold(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, int iGold, bool bSuccess, int iBullyMetricScore);static void ReplaceCvDiplomacyAI_LogMinorCivBullyGold(void (*original)(CvDiplomacyAI*, PlayerTypes, int, int, int, bool, int), CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, int iGold, bool bSuccess, int iBullyMetricScore);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogMinorCivBullyGold>(host, &BeforeCvDiplomacyAI_LogMinorCivBullyGold);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogMinorCivBullyGold>(host, &AfterCvDiplomacyAI_LogMinorCivBullyGold);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogMinorCivBullyGold>(host, &ReplaceCvDiplomacyAI_LogMinorCivBullyGold);
Code
24698/// AI is doing something with a Minor civ24699void CvDiplomacyAI::LogMinorCivBullyGold(PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, int iGold, bool bSuccess, int iBullyMetricScore)24700{24701 if(GC.getLogging() && GC.getAILogging())24702 {24703 CvString strLogName;2470424705 CvString strOutBuf;24706 CvString strBaseString;2470724708 CvString playerName;24709 CvString otherPlayerName;2471024711 CvString strTemp;2471224713 playerName = GetPlayer()->getCivilizationShortDescription();2471424715 // Open the log file24716 if(GC.getPlayerAndCityAILogSplit())24717 strLogName = "DiplomacyAI_MinorCiv_Log_" + playerName + ".csv";24718 else24719 strLogName = "DiplomacyAI_MinorCiv_Log.csv";2472024721 FILogFile* pLog;24722 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2472324724 // Turn number24725 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2472624727 // Our Name24728 strBaseString += playerName;2472924730 // Their Name24731 otherPlayerName = GET_PLAYER(eMinor).getCivilizationShortDescription();24732 strBaseString += ", " + otherPlayerName;2473324734 strOutBuf = strBaseString;2473524736 // Gold tribute24737 strTemp.Format("Gold Bully: %d", iGold);24738 strOutBuf += ", " + strTemp;2473924740 strTemp.Format("Friendship: %d to %d", iOldFriendshipTimes100 / 100, iNewFriendshipTimes100 / 100);24741 strOutBuf += ", " + strTemp;2474224743 LogGrandStrategy(strOutBuf);2474424745 // City State type24746 strOutBuf += ", ";24747 strOutBuf += GC.getMinorCivInfo(GET_PLAYER(eMinor).GetMinorCivAI()->GetMinorCivType())->GetType();2474824749 // Did it work?24750 if(bSuccess)24751 {24752 strOutBuf += ", ";24753 strOutBuf += "Success!";24754 }24755 else24756 {24757 strOutBuf += ", ";24758 strOutBuf += "Failure";24759 }2476024761 // Append the bully metric score24762 strTemp.Format("Bully Score: %d", iBullyMetricScore);24763 strOutBuf += ", " + strTemp;2476424765 pLog->Msg(strOutBuf);2476624767 OutputDebugString("\n");24768 OutputDebugString(strOutBuf);24769 OutputDebugString("\n");24770 }24771}