Hooks
static bool BeforeCvDiplomacyAI_LogMinorCivQuestCancelled(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType);static void AfterCvDiplomacyAI_LogMinorCivQuestCancelled(CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType);static void ReplaceCvDiplomacyAI_LogMinorCivQuestCancelled(void (*original)(CvDiplomacyAI*, PlayerTypes, int, int, MinorCivQuestTypes), CvDiplomacyAI* self, PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogMinorCivQuestCancelled>(host, &BeforeCvDiplomacyAI_LogMinorCivQuestCancelled);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogMinorCivQuestCancelled>(host, &AfterCvDiplomacyAI_LogMinorCivQuestCancelled);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogMinorCivQuestCancelled>(host, &ReplaceCvDiplomacyAI_LogMinorCivQuestCancelled);
Code
24967/// A quest became obsolete and was cancelled, so log it24968void CvDiplomacyAI::LogMinorCivQuestCancelled(PlayerTypes eMinor, int iOldFriendshipTimes100, int iNewFriendshipTimes100, MinorCivQuestTypes eType)24969{24970 if(GC.getLogging() && GC.getAILogging())24971 {24972 CvString strLogName;2497324974 CvString strOutBuf;24975 CvString strBaseString;2497624977 CvString playerName;24978 CvString otherPlayerName;2497924980 CvString strTemp;2498124982 playerName = GetPlayer()->getCivilizationShortDescription();2498324984 // Open the log file24985 if(GC.getPlayerAndCityAILogSplit())24986 strLogName = "DiplomacyAI_MinorCiv_Log_" + playerName + ".csv";24987 else24988 strLogName = "DiplomacyAI_MinorCiv_Log.csv";2498924990 FILogFile* pLog;24991 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2499224993 // Turn number24994 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2499524996 // Our Name24997 strBaseString += playerName;2499824999 // Their Name25000 otherPlayerName = GET_PLAYER(eMinor).getCivilizationShortDescription();25001 strBaseString += ", " + otherPlayerName;2500225003 strOutBuf = strBaseString;2500425005 // Quest Info25006 strTemp = "cancelled";25007 strOutBuf += ", " + strTemp;2500825009 LogMinorCivQuestType(strOutBuf, eType);2501025011 // Friendship Change25012 strTemp.Format("Friendship: %d to %d", iOldFriendshipTimes100 / 100, iNewFriendshipTimes100 / 100);25013 strOutBuf += ", " + strTemp;2501425015 // City State type25016 strOutBuf += ", ";25017 strOutBuf += GC.getMinorCivInfo(GET_PLAYER(eMinor).GetMinorCivAI()->GetMinorCivType())->GetType();2501825019 pLog->Msg(strOutBuf);2502025021 OutputDebugString("\n");25022 OutputDebugString(strOutBuf);25023 OutputDebugString("\n");25024 }25025}