Hooks
static bool BeforeCvAStar_cpp_LogPathGeneration(const CvUnit * pkUnit, CvString& strMsg);static void AfterCvAStar_cpp_LogPathGeneration(const CvUnit * pkUnit, CvString& strMsg);static void ReplaceCvAStar_cpp_LogPathGeneration(void (*original)(const CvUnit *, CvString&), const CvUnit * pkUnit, CvString& strMsg);CivRegisterBefore<CivHooks::CvAStar_cpp_LogPathGeneration>(host, &BeforeCvAStar_cpp_LogPathGeneration);CivRegisterAfter<CivHooks::CvAStar_cpp_LogPathGeneration>(host, &AfterCvAStar_cpp_LogPathGeneration);CivRegisterReplace<CivHooks::CvAStar_cpp_LogPathGeneration>(host, &ReplaceCvAStar_cpp_LogPathGeneration);
Code
2876// Path logging2877static void LogPathGeneration(const CvUnit *pkUnit, CvString& strMsg)2878{2879 if(GC.getLogging() && GC.getAILogging() && pkUnit)2880 {2881 CvString strOutBuf;2882 CvString strBaseString;28832884 CvPlayer& kPlayer = GET_PLAYER(pkUnit->getOwner());2885 const char* pszPlayerName = kPlayer.getCivilizationShortDescription();2886 FILogFile* pLog = LOGFILEMGR.GetLog((gDLL->IsGameCoreThread())?"AStar_GC.log":"AStar_APP.log", FILogFile::kDontTimeStamp, "Game Turn, Player, Unit, From X, From Y, To X, To Y, Info, Checksum");28872888 // Get the leading info for this line2889 strBaseString.Format("%03d, %s, UnitID: %d, ", GC.getGame().getElapsedGameTurns(), (pszPlayerName)?pszPlayerName:"?", pkUnit->GetID());2890 strOutBuf = strBaseString + strMsg;2891 pLog->Msg(strOutBuf);2892 }2893}