Bazaar developer reference

CvMilitaryAI::LogPeace(TeamTypes)

Defined in
CvMilitaryAI.cpp, line 2001
Class
CvMilitaryAI
Hook name
CivHooks::CvMilitaryAI_LogPeace_with_TeamTypes

Hooks

static bool BeforeCvMilitaryAI_LogPeace_with_TeamTypes(CvMilitaryAI* self, TeamTypes eOpponentTeam);static void AfterCvMilitaryAI_LogPeace_with_TeamTypes(CvMilitaryAI* self, TeamTypes eOpponentTeam);static void ReplaceCvMilitaryAI_LogPeace_with_TeamTypes(void (*original)(CvMilitaryAI*, TeamTypes), CvMilitaryAI* self, TeamTypes eOpponentTeam);CivRegisterBefore<CivHooks::CvMilitaryAI_LogPeace_with_TeamTypes>(host, &BeforeCvMilitaryAI_LogPeace_with_TeamTypes);CivRegisterAfter<CivHooks::CvMilitaryAI_LogPeace_with_TeamTypes>(host, &AfterCvMilitaryAI_LogPeace_with_TeamTypes);CivRegisterReplace<CivHooks::CvMilitaryAI_LogPeace_with_TeamTypes>(host, &ReplaceCvMilitaryAI_LogPeace_with_TeamTypes);

Code

2000/// Log it if we make peace2001void CvMilitaryAI::LogPeace(TeamTypes eOpponentTeam)2002{2003	if(GC.getLogging() && GC.getAILogging())2004	{2005		CvString strOutBuf;2006		CvString strBaseString;2007		CvString strOpponentName;2008		CvString strPlayerName;2009		CvString strTemp;2010		FILogFile* pLog;20112012		// Open the right file2013		strPlayerName = GetPlayer()->getCivilizationShortDescription();2014		pLog = LOGFILEMGR.GetLog(GetLogFileName(strPlayerName), FILogFile::kDontTimeStamp);20152016		// Get the leading info for this line2017		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());2018		strBaseString += strPlayerName + ", ";20192020		// Collect the names of the players on the team2021		for(int iPlayer = 0; iPlayer < MAX_PLAYERS; ++iPlayer)2022		{2023			CvPlayer& kPlayer = GET_PLAYER((PlayerTypes) iPlayer);2024			if(kPlayer.isAlive() && kPlayer.getTeam() == eOpponentTeam)2025			{2026				if(strOpponentName.GetLength() != 0)2027					strOpponentName += ", ";20282029				strOpponentName += kPlayer.getCivilizationShortDescription();2030			}2031		}2032		// Strategy Info2033		strTemp.Format("Made peace with team: %d (%s)", (int)eOpponentTeam, strOpponentName.GetCString());2034		strOutBuf = strBaseString + strTemp;2035		pLog->Msg(strOutBuf);20362037		LogMilitarySummaryMessage(strTemp);2038	}2039}

Calls

Called by