Bazaar developer reference

CvMilitaryAI::LogCityCaptured(CvCity *, PlayerTypes)

Defined in
CvMilitaryAI.cpp, line 1905
Class
CvMilitaryAI
Hook name
CivHooks::CvMilitaryAI_LogCityCaptured

Hooks

static bool BeforeCvMilitaryAI_LogCityCaptured(CvMilitaryAI* self, CvCity* pCity, PlayerTypes eOldOwner);static void AfterCvMilitaryAI_LogCityCaptured(CvMilitaryAI* self, CvCity* pCity, PlayerTypes eOldOwner);static void ReplaceCvMilitaryAI_LogCityCaptured(void (*original)(CvMilitaryAI*, CvCity*, PlayerTypes), CvMilitaryAI* self, CvCity* pCity, PlayerTypes eOldOwner);CivRegisterBefore<CivHooks::CvMilitaryAI_LogCityCaptured>(host, &BeforeCvMilitaryAI_LogCityCaptured);CivRegisterAfter<CivHooks::CvMilitaryAI_LogCityCaptured>(host, &AfterCvMilitaryAI_LogCityCaptured);CivRegisterReplace<CivHooks::CvMilitaryAI_LogCityCaptured>(host, &ReplaceCvMilitaryAI_LogCityCaptured);

Code

1904/// Log it if we capture a city1905void CvMilitaryAI::LogCityCaptured(CvCity* pCity, PlayerTypes eOldOwner)1906{1907	if(GC.getLogging() && GC.getAILogging())1908	{1909		CvString strOutBuf;1910		CvString strBaseString;1911		CvString strPlayerName;1912		CvString strOldOwnerName;1913		CvString strCityName;1914		CvString strTemp;1915		FILogFile* pLog;19161917		// Open the right file1918		strPlayerName = GetPlayer()->getCivilizationShortDescription();1919		strOldOwnerName = GET_PLAYER(eOldOwner).getCivilizationShortDescription();1920		strCityName = pCity->getName();1921		pLog = LOGFILEMGR.GetLog(GetLogFileName(strPlayerName), FILogFile::kDontTimeStamp);19221923		// Get the leading info for this line1924		strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1925		strBaseString += strPlayerName + ", ";19261927		// Strategy Info1928		strTemp = "Captured: " + strCityName + ", ";1929		strTemp += "From: " + strOldOwnerName;1930		strOutBuf = strBaseString + strTemp;1931		pLog->Msg(strOutBuf);19321933		LogMilitarySummaryMessage(strTemp);1934	}1935}

Calls

Called by