Bazaar developer reference

CvMilitaryAI::LogDeclarationOfWar(PlayerTypes)

Defined in
CvMilitaryAI.cpp, line 1847
Class
CvMilitaryAI
Hook name
CivHooks::CvMilitaryAI_LogDeclarationOfWar

Hooks

static bool BeforeCvMilitaryAI_LogDeclarationOfWar(CvMilitaryAI* self, PlayerTypes eOpponent);static void AfterCvMilitaryAI_LogDeclarationOfWar(CvMilitaryAI* self, PlayerTypes eOpponent);static void ReplaceCvMilitaryAI_LogDeclarationOfWar(void (*original)(CvMilitaryAI*, PlayerTypes), CvMilitaryAI* self, PlayerTypes eOpponent);CivRegisterBefore<CivHooks::CvMilitaryAI_LogDeclarationOfWar>(host, &BeforeCvMilitaryAI_LogDeclarationOfWar);CivRegisterAfter<CivHooks::CvMilitaryAI_LogDeclarationOfWar>(host, &AfterCvMilitaryAI_LogDeclarationOfWar);CivRegisterReplace<CivHooks::CvMilitaryAI_LogDeclarationOfWar>(host, &ReplaceCvMilitaryAI_LogDeclarationOfWar);

Code

1846/// Log it if we issue a DOW1847void CvMilitaryAI::LogDeclarationOfWar(PlayerTypes eOpponent)1848{1849	if(GC.getLogging() && GC.getAILogging())1850	{1851		CvString strOutBuf;1852		CvString strBaseString;1853		CvString opponentName;1854		CvString playerName;1855		CvString strTemp;1856		FILogFile* pLog;18571858		// Open the right file1859		playerName = GetPlayer()->getCivilizationShortDescription();1860		opponentName = GET_PLAYER(eOpponent).getCivilizationShortDescription();1861		pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName), FILogFile::kDontTimeStamp);18621863		// Get the leading info for this line1864		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1865		strBaseString += playerName + ", ";18661867		// Strategy Info1868		strTemp.Format("Declared War on: %s", opponentName.GetCString());1869		strOutBuf = strBaseString + strTemp;1870		pLog->Msg(strOutBuf);18711872		LogMilitarySummaryMessage(strTemp);1873	}1874}

Calls

Called by