Hooks
static bool BeforeCvCityStrategyAI_LogHurry(CvCityStrategyAI* self, HurryTypes iHurryType, int iHurryAmount, int iHurryAmountAvailable, int iTurnsSaved);static void AfterCvCityStrategyAI_LogHurry(CvCityStrategyAI* self, HurryTypes iHurryType, int iHurryAmount, int iHurryAmountAvailable, int iTurnsSaved);static void ReplaceCvCityStrategyAI_LogHurry(void (*original)(CvCityStrategyAI*, HurryTypes, int, int, int), CvCityStrategyAI* self, HurryTypes iHurryType, int iHurryAmount, int iHurryAmountAvailable, int iTurnsSaved);CivRegisterBefore<CivHooks::CvCityStrategyAI_LogHurry>(host, &BeforeCvCityStrategyAI_LogHurry);CivRegisterAfter<CivHooks::CvCityStrategyAI_LogHurry>(host, &AfterCvCityStrategyAI_LogHurry);CivRegisterReplace<CivHooks::CvCityStrategyAI_LogHurry>(host, &ReplaceCvCityStrategyAI_LogHurry);
Code
1787void CvCityStrategyAI::LogHurry(HurryTypes iHurryType, int iHurryAmount, int iHurryAmountAvailable, int iTurnsSaved)1788{1789 if(GC.getLogging() && GC.getAILogging())1790 {1791 CvString strOutBuf;1792 CvString strBaseString;1793 CvString strTemp;1794 CvString playerName;1795 CvString cityName;1796 CvString strDesc;17971798 // Find the name of this civ and city1799 playerName = GET_PLAYER(m_pCity->getOwner()).getCivilizationShortDescription();1800 cityName = m_pCity->getName();18011802 // Open the log file1803 FILogFile* pLog;1804 pLog = LOGFILEMGR.GetLog(GetLogFileName(playerName, cityName), FILogFile::kDontTimeStamp);18051806 // Get the leading info for this line1807 strBaseString.Format("%03d, ", GC.getGame().getElapsedGameTurns());1808 strBaseString += playerName + ", " + cityName + ", ";18091810 if(iHurryType == 0)1811 {1812 strTemp.Format("Pop rushed: %s, Spent: %d, Available: %d, Turns Saved: %d", m_pCity->getProductionName(), iHurryAmount, iHurryAmountAvailable, iTurnsSaved);1813 }1814 else1815 {1816 strTemp.Format("Gold rushed: %s, Spent: %d, Available: %d, Turns Saved: %d", m_pCity->getProductionName(), iHurryAmount, iHurryAmountAvailable, iTurnsSaved);1817 }18181819 strOutBuf = strBaseString + strTemp;1820 pLog->Msg(strOutBuf);1821 }1822}