Hooks
static bool BeforeCvDiplomacyAI_LogMinorCivGiftGold(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendship, int iGold, bool bSaving, bool bWantQuickBoost, PlayerTypes ePlayerTryingToPass);static void AfterCvDiplomacyAI_LogMinorCivGiftGold(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendship, int iGold, bool bSaving, bool bWantQuickBoost, PlayerTypes ePlayerTryingToPass);static void ReplaceCvDiplomacyAI_LogMinorCivGiftGold(void (*original)(CvDiplomacyAI*, PlayerTypes, int, int, bool, bool, PlayerTypes), CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendship, int iGold, bool bSaving, bool bWantQuickBoost, PlayerTypes ePlayerTryingToPass);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogMinorCivGiftGold>(host, &BeforeCvDiplomacyAI_LogMinorCivGiftGold);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogMinorCivGiftGold>(host, &AfterCvDiplomacyAI_LogMinorCivGiftGold);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogMinorCivGiftGold>(host, &ReplaceCvDiplomacyAI_LogMinorCivGiftGold);
Code
24624/// AI is doing something with a Minor civ24625void CvDiplomacyAI::LogMinorCivGiftGold(PlayerTypes eMinor, int iOldFriendship, int iGold, bool bSaving, bool bWantQuickBoost, PlayerTypes ePlayerTryingToPass)24626{24627 if(GC.getLogging() && GC.getAILogging())24628 {24629 CvString strLogName;2463024631 CvString strOutBuf;24632 CvString strBaseString;2463324634 CvString playerName;24635 CvString otherPlayerName;2463624637 CvString strTemp;2463824639 playerName = GetPlayer()->getCivilizationShortDescription();2464024641 // Open the log file24642 if(GC.getPlayerAndCityAILogSplit())24643 strLogName = "DiplomacyAI_MinorCiv_Log_" + playerName + ".csv";24644 else24645 strLogName = "DiplomacyAI_MinorCiv_Log.csv";2464624647 FILogFile* pLog;24648 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2464924650 // Turn number24651 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2465224653 // Our Name24654 strBaseString += playerName;2465524656 // Their Name24657 otherPlayerName = GET_PLAYER(eMinor).getCivilizationShortDescription();24658 strBaseString += ", " + otherPlayerName;2465924660 strOutBuf = strBaseString;2466124662 // Gift amount24663 strTemp.Format("Gold Gift: %d", iGold);24664 strOutBuf += ", " + strTemp;2466524666 strTemp.Format("Friendship: %d to %d", iOldFriendship, GET_PLAYER(eMinor).GetMinorCivAI()->GetEffectiveFriendshipWithMajor(GetPlayer()->GetID()));24667 strOutBuf += ", " + strTemp;2466824669 LogGrandStrategy(strOutBuf);2467024671 // City State type24672 strOutBuf += ", ";24673 strOutBuf += GC.getMinorCivInfo(GET_PLAYER(eMinor).GetMinorCivAI()->GetMinorCivType())->GetType();2467424675 // Saving Gold for Gift24676 if(bSaving)24677 strOutBuf += ", (SAVING) ";2467824679 // Wants a quick boost24680 if(bWantQuickBoost)24681 strOutBuf += ", Boost! ";2468224683 // Trying to pass up a player!24684 if(ePlayerTryingToPass != NO_PLAYER)24685 {24686 strOutBuf += ", Passing ";24687 strOutBuf += GET_PLAYER(ePlayerTryingToPass).getCivilizationShortDescription();24688 }2468924690 pLog->Msg(strOutBuf);2469124692 OutputDebugString("\n");24693 OutputDebugString(strOutBuf);24694 OutputDebugString("\n");24695 }24696}