CvDiplomacyAI::LogPublicDeclaration(PublicDeclarationTypes, int, PlayerTypes)
- Defined in
- CvDiplomacyAI.cpp, line 25331
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_LogPublicDeclaration
Hooks
static bool BeforeCvDiplomacyAI_LogPublicDeclaration(CvDiplomacyAI* self, PublicDeclarationTypes eDeclaration, int iData1, PlayerTypes eForSpecificPlayer);static void AfterCvDiplomacyAI_LogPublicDeclaration(CvDiplomacyAI* self, PublicDeclarationTypes eDeclaration, int iData1, PlayerTypes eForSpecificPlayer);static void ReplaceCvDiplomacyAI_LogPublicDeclaration(void (*original)(CvDiplomacyAI*, PublicDeclarationTypes, int, PlayerTypes), CvDiplomacyAI* self, PublicDeclarationTypes eDeclaration, int iData1, PlayerTypes eForSpecificPlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogPublicDeclaration>(host, &BeforeCvDiplomacyAI_LogPublicDeclaration);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogPublicDeclaration>(host, &AfterCvDiplomacyAI_LogPublicDeclaration);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogPublicDeclaration>(host, &ReplaceCvDiplomacyAI_LogPublicDeclaration);
Code
25330/// Log public declaration made by this AI25331void CvDiplomacyAI::LogPublicDeclaration(PublicDeclarationTypes eDeclaration, int iData1, PlayerTypes eForSpecificPlayer)25332{25333 if(GC.getLogging() && GC.getAILogging())25334 {25335 // JON: Disabling some logspam25336 if(eForSpecificPlayer != NO_PLAYER)25337 return;2533825339 CvString strLogName;2534025341 CvString strOutBuf;25342 CvString strBaseString;2534325344 CvString playerName;25345 CvString otherPlayerName;2534625347 CvString strTemp;2534825349 playerName = GetPlayer()->getCivilizationShortDescription();2535025351 // Open the log file25352 if(GC.getPlayerAndCityAILogSplit())25353 {25354 strLogName = "DiplomacyAI_Messages_Log_" + playerName + ".csv";25355 }25356 else25357 {25358 strLogName = "DiplomacyAI_Messages_Log.csv";25359 }2536025361 FILogFile* pLog;25362 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2536325364 // Turn number25365 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2536625367 // Our Name25368 strBaseString += playerName;2536925370 strOutBuf = strBaseString;2537125372 // Is this declaration for a specific player (one we met after we made the declaration?)25373 if(eForSpecificPlayer != NO_PLAYER)25374 {25375 otherPlayerName = GET_PLAYER(eForSpecificPlayer).getCivilizationShortDescription();25376 strTemp = "To " + otherPlayerName;25377 strOutBuf += ", " + strTemp;25378 }2537925380 PlayerTypes eMinorCiv;2538125382 bool bMinorMessage = false;2538325384 switch(eDeclaration)25385 {25386 case PUBLIC_DECLARATION_PROTECT_MINOR:25387 eMinorCiv = (PlayerTypes) iData1;25388 otherPlayerName = GET_PLAYER(eMinorCiv).getCivilizationShortDescription();25389 strTemp = "We're now protecting " + otherPlayerName + "!";25390 bMinorMessage = true;25391 break;25392 case PUBLIC_DECLARATION_ABANDON_MINOR:25393 eMinorCiv = (PlayerTypes) iData1;25394 otherPlayerName = GET_PLAYER(eMinorCiv).getCivilizationShortDescription();25395 strTemp = "We've abandoned " + otherPlayerName + "!";25396 bMinorMessage = true;25397 break;25398 default:25399 strTemp.Format("Unknown Declaration!!!");25400 break;25401 }2540225403 strOutBuf += ", " + strTemp;2540425405 pLog->Msg(strOutBuf);2540625407 // Also send message to Minor Civ log if applicable25408 if(bMinorMessage)25409 {25410 // Open the log file25411 if(GC.getPlayerAndCityAILogSplit())25412 strLogName = "DiplomacyAI_MinorCiv_Log_" + playerName + ".csv";25413 else25414 strLogName = "DiplomacyAI_MinorCiv_Log.csv";2541525416 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);25417 pLog->Msg(strOutBuf);25418 }2541925420 OutputDebugString("\n");25421 OutputDebugString(strOutBuf);25422 OutputDebugString("\n");25423 }25424}
Calls
- CvDiplomacyAI::GetPlayer()
- CvGame::getElapsedGameTurns() const
- CvGlobals::getAILogging()
- CvGlobals::getGame()
- CvGlobals::getLogging()
- CvGlobals::getPlayerAndCityAILogSplit()
- CvPlayer::getCivilizationShortDescription() const
- CvPlayerAI::getPlayer(PlayerTypes)
CvString::CvStringCvString::FormatCvString::operator const char *CvString::operator=CvString::operator=CvString::operator=FILogFile::MsgFILogFileMgr::GetInstanceFILogFileMgr::GetLogstd::basic_string::operator+=std::operator+std::operator+