Hooks
static bool BeforeCvPlayerTechs_LogFlavors(CvPlayerTechs* self, FlavorTypes eFlavor);static void AfterCvPlayerTechs_LogFlavors(CvPlayerTechs* self, FlavorTypes eFlavor);static void ReplaceCvPlayerTechs_LogFlavors(void (*original)(CvPlayerTechs*, FlavorTypes), CvPlayerTechs* self, FlavorTypes eFlavor);CivRegisterBefore<CivHooks::CvPlayerTechs_LogFlavors>(host, &BeforeCvPlayerTechs_LogFlavors);CivRegisterAfter<CivHooks::CvPlayerTechs_LogFlavors>(host, &AfterCvPlayerTechs_LogFlavors);CivRegisterReplace<CivHooks::CvPlayerTechs_LogFlavors>(host, &ReplaceCvPlayerTechs_LogFlavors);
Code
1665void CvPlayerTechs::LogFlavors(FlavorTypes eFlavor)1666{1667 if(GC.getLogging() && GC.getAILogging())1668 {1669 CvString strOutBuf;1670 CvString strBaseString;1671 CvString strTemp;1672 CvString playerName;1673 CvString strDesc;1674 CvString strLogName;16751676 // Find the name of this civ1677 playerName = m_pPlayer->getCivilizationShortDescription();16781679 // Open the log file1680 if(GC.getPlayerAndCityAILogSplit())1681 {1682 strLogName = "TechAILog_" + playerName + ".csv";1683 }1684 else1685 {1686 strLogName = "TechAILog.csv";1687 }16881689 FILogFile* pLog;1690 pLog = LOGFILEMGR.GetLog(strLogName, FILogFile::kDontTimeStamp);16911692 // Get the leading info for this line1693 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1694 strBaseString += playerName + ", ";16951696 // Dump out the setting for each flavor1697 if(eFlavor == NO_FLAVOR)1698 {1699 for(int iI = 0; iI < GC.getNumFlavorTypes(); iI++)1700 {1701 strTemp.Format("Flavor, %s, %d", GC.getFlavorTypes((FlavorTypes)iI).GetCString(), m_piLatestFlavorValues[iI]);1702 strOutBuf = strBaseString + strTemp;1703 pLog->Msg(strOutBuf);1704 }1705 }1706 else1707 {1708 strTemp.Format("Flavor, %s, %d", GC.getFlavorTypes(eFlavor).GetCString(), m_piLatestFlavorValues[eFlavor]);1709 strOutBuf = strBaseString + strTemp;1710 pLog->Msg(strOutBuf);1711 }1712 }1713}