Hooks
static bool BeforeCvCityStrategyAI_LogFlavors(CvCityStrategyAI* self, FlavorTypes eFlavor);static void AfterCvCityStrategyAI_LogFlavors(CvCityStrategyAI* self, FlavorTypes eFlavor);static void ReplaceCvCityStrategyAI_LogFlavors(void (*original)(CvCityStrategyAI*, FlavorTypes), CvCityStrategyAI* self, FlavorTypes eFlavor);CivRegisterBefore<CivHooks::CvCityStrategyAI_LogFlavors>(host, &BeforeCvCityStrategyAI_LogFlavors);CivRegisterAfter<CivHooks::CvCityStrategyAI_LogFlavors>(host, &AfterCvCityStrategyAI_LogFlavors);CivRegisterReplace<CivHooks::CvCityStrategyAI_LogFlavors>(host, &ReplaceCvCityStrategyAI_LogFlavors);
Code
1842/// Log new flavor settings1843void CvCityStrategyAI::LogFlavors(FlavorTypes eFlavor)1844{1845 if(GC.getLogging() && GC.getAILogging())1846 {1847 CvString strOutBuf;1848 CvString strBaseString;1849 CvString strTemp;1850 CvString playerName;1851 CvString cityName;1852 CvString strDesc;18531854 // Find the name of this civ and city1855 playerName = GET_PLAYER(m_pCity->getOwner()).getCivilizationShortDescription();1856 cityName = m_pCity->getName();18571858 // Open the log file1859 FILogFile* pLog;1860 pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName, cityName), FILogFile::kDontTimeStamp);18611862 // Get the leading info for this line1863 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1864 strBaseString += playerName + ", " + cityName + ", ";18651866 // Dump out the setting for each flavor1867 if(eFlavor == NO_FLAVOR)1868 {1869 for(int iI = 0; iI < GC.getNumFlavorTypes(); iI++)1870 {1871 // Only dump if non-zero1872 // if (m_piLatestFlavorValues[iI] > 0)1873 {1874 strTemp.Format("Flavor, %s, %d", GC.getFlavorTypes((FlavorTypes)iI).GetCString(), m_piLatestFlavorValues[iI]);1875 strOutBuf = strBaseString + strTemp;1876 pLog->Msg(strOutBuf);1877 }1878 }1879 }1880 else1881 {1882 strTemp.Format("Flavor, %s, %d", GC.getFlavorTypes(eFlavor).GetCString(), m_piLatestFlavorValues[eFlavor]);1883 strOutBuf = strBaseString + strTemp;1884 pLog->Msg(strOutBuf);1885 }1886 }1887}