Hooks
static bool BeforeCvCityStrategyAI_LogStrategy(CvCityStrategyAI* self, AICityStrategyTypes eStrategy, bool bValue);static void AfterCvCityStrategyAI_LogStrategy(CvCityStrategyAI* self, AICityStrategyTypes eStrategy, bool bValue);static void ReplaceCvCityStrategyAI_LogStrategy(void (*original)(CvCityStrategyAI*, AICityStrategyTypes, bool), CvCityStrategyAI* self, AICityStrategyTypes eStrategy, bool bValue);CivRegisterBefore<CivHooks::CvCityStrategyAI_LogStrategy>(host, &BeforeCvCityStrategyAI_LogStrategy);CivRegisterAfter<CivHooks::CvCityStrategyAI_LogStrategy>(host, &AfterCvCityStrategyAI_LogStrategy);CivRegisterReplace<CivHooks::CvCityStrategyAI_LogStrategy>(host, &ReplaceCvCityStrategyAI_LogStrategy);
Code
1889/// Log a city strategy1890void CvCityStrategyAI::LogStrategy(AICityStrategyTypes eStrategy, bool bValue)1891{1892 if(GC.getLogging() && GC.getAILogging())1893 {1894 CvString strOutBuf;1895 CvString strBaseString;18961897 // Find the name of this civ and city1898 CvString playerName = GET_PLAYER(m_pCity->getOwner()).getCivilizationShortDescription();1899 CvString cityName = m_pCity->getName();19001901 // Open the log file1902 FILogFile* pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName, cityName), FILogFile::kDontTimeStamp);19031904 // Get the leading info for this line1905 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1906 strBaseString += playerName + ", " + cityName + ", ";19071908 strOutBuf = strBaseString;19091910 // Strategy Info1911 CvAICityStrategyEntry* pStrategyEntry = GC.getAICityStrategyInfo(eStrategy);1912 if(pStrategyEntry != NULL)1913 {1914 CvString strTemp;1915 strTemp.Format("%s, %d", pStrategyEntry->GetType(), bValue);1916 strOutBuf += strTemp;1917 }19181919 pLog->Msg(strOutBuf);1920 }1921}