Bazaar developer reference

CvDiplomacyAI::LogCoopWar(PlayerTypes, PlayerTypes, CoopWarStates)

Defined in
CvDiplomacyAI.cpp, line 25700
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_LogCoopWar

Hooks

static bool BeforeCvDiplomacyAI_LogCoopWar(CvDiplomacyAI* self, PlayerTypes ePlayer, PlayerTypes eAgainstPlayer, CoopWarStates eAcceptedState);static void AfterCvDiplomacyAI_LogCoopWar(CvDiplomacyAI* self, PlayerTypes ePlayer, PlayerTypes eAgainstPlayer, CoopWarStates eAcceptedState);static void ReplaceCvDiplomacyAI_LogCoopWar(void (*original)(CvDiplomacyAI*, PlayerTypes, PlayerTypes, CoopWarStates), CvDiplomacyAI* self, PlayerTypes ePlayer, PlayerTypes eAgainstPlayer, CoopWarStates eAcceptedState);CivRegisterBefore<CivHooks::CvDiplomacyAI_LogCoopWar>(host, &BeforeCvDiplomacyAI_LogCoopWar);CivRegisterAfter<CivHooks::CvDiplomacyAI_LogCoopWar>(host, &AfterCvDiplomacyAI_LogCoopWar);CivRegisterReplace<CivHooks::CvDiplomacyAI_LogCoopWar>(host, &ReplaceCvDiplomacyAI_LogCoopWar);

Code

25699/// Log working with a player25700void CvDiplomacyAI::LogCoopWar(PlayerTypes ePlayer, PlayerTypes eAgainstPlayer, CoopWarStates eAcceptedState)25701{25702	if(GC.getLogging() && GC.getAILogging())25703	{25704		CvString strOutBuf;25705		CvString strBaseString;25706		CvString playerName;25707		CvString strDesc;25708		CvString strLogName;2570925710		// Find the name of this civ and city25711		playerName = GetPlayer()->getCivilizationShortDescription();2571225713		// Open the log file25714		if(GC.getPlayerAndCityAILogSplit())25715		{25716			strLogName = "DiplomacyAI_Messages_Log_" + playerName + ".csv";25717		}25718		else25719		{25720			strLogName = "DiplomacyAI_Messages_Log.csv";25721		}2572225723		FILogFile* pLog;25724		pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);2572525726		// Get the leading info for this line25727		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());25728		strBaseString += playerName + ", ";2572925730		CvString otherPlayerName = GET_PLAYER(ePlayer).getCivilizationShortDescription();25731		CvString againstPlayerName = GET_PLAYER(eAgainstPlayer).getCivilizationShortDescription();2573225733		// Did they actually agree?25734		if(eAcceptedState == COOP_WAR_STATE_ACCEPTED)25735			strOutBuf = strBaseString + ",***** NOW coop war with " + otherPlayerName + " against " + againstPlayerName + "! *****";25736		// Asked and player said soon25737		else if(eAcceptedState == COOP_WAR_STATE_SOON)25738			strOutBuf = strBaseString + ",***** SOON coop war with " + otherPlayerName + " against " + againstPlayerName + "! *****";25739		// Asked but player declined25740		else if(eAcceptedState == COOP_WAR_STATE_REJECTED)25741			strOutBuf = strBaseString + ", wanted coop war with " + otherPlayerName + " against " + againstPlayerName + "!";2574225743		pLog->Msg(strOutBuf);2574425745		OutputDebugString("\n");25746		OutputDebugString(strOutBuf);25747		OutputDebugString("\n");25748	}25749}

Calls

Called by