Hooks
static bool BeforeCvDiplomacyAI_LogMinorCivQuestReceived(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType);static void AfterCvDiplomacyAI_LogMinorCivQuestReceived(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType);static void ReplaceCvDiplomacyAI_LogMinorCivQuestReceived(void (*original)(CvDiplomacyAI*, PlayerTypes, int, int, MinorCivQuestTypes), CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogMinorCivQuestReceived>(host, &BeforeCvDiplomacyAI_LogMinorCivQuestReceived);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogMinorCivQuestReceived>(host, &AfterCvDiplomacyAI_LogMinorCivQuestReceived);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogMinorCivQuestReceived>(host, &ReplaceCvDiplomacyAI_LogMinorCivQuestReceived);
Code
24847/// A quest was given to us, so log it24848void CvDiplomacyAI::LogMinorCivQuestReceived(PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType)24849{24850 if(GC.getLogging() && GC.getAILogging())24851 {24852 CvString strLogName;2485324854 CvString strOutBuf;24855 CvString strBaseString;2485624857 CvString playerName;24858 CvString otherPlayerName;2485924860 CvString strTemp;2486124862 playerName = GetPlayer()->getCivilizationShortDescription();2486324864 // Open the log file24865 if(GC.getPlayerAndCityAILogSplit())24866 strLogName = "DiplomacyAI_MinorCiv_Log_" + playerName + ".csv";24867 else24868 strLogName = "DiplomacyAI_MinorCiv_Log.csv";2486924870 FILogFile* pLog;24871 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2487224873 // Turn number24874 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2487524876 // Our Name24877 strBaseString += playerName;2487824879 // Their Name24880 otherPlayerName = GET_PLAYER(eMinor).getCivilizationShortDescription();24881 strBaseString += ", " + otherPlayerName;2488224883 strOutBuf = strBaseString;2488424885 // Quest Info24886 strTemp = "RECEIVED QUEST";24887 strOutBuf += ", " + strTemp;2488824889 LogMinorCivQuestType(strOutBuf, eType);2489024891 // Friendship Change24892 strTemp.Format("Friendship: %d to %d", iOldFriendshipTimes100 / 100, iNewFriendshipTimes100 / 100);24893 strOutBuf += ", " + strTemp;2489424895 // City State type24896 strOutBuf += ", ";24897 strOutBuf += GC.getMinorCivInfo(GET_PLAYER(eMinor).GetMinorCivAI()->GetMinorCivType())->GetType();2489824899 pLog->Msg(strOutBuf);2490024901 OutputDebugString("\n");24902 OutputDebugString(strOutBuf);24903 OutputDebugString("\n");24904 }24905}