diff --git a/core/metamod.cpp b/core/metamod.cpp index fddf2c8..80a8df0 100644 --- a/core/metamod.cpp +++ b/core/metamod.cpp @@ -516,7 +516,7 @@ mm_LoadPluginsFromFile(const char *_file) fp = fopen(_file, "rt"); if (!fp) { - LogMessage("[META] Could not open plugins file %s\n", _file); + mm_LogMessage("[META] Could not open plugins file %s\n", _file); return -1; } @@ -590,18 +590,14 @@ mm_LoadPluginsFromFile(const char *_file) id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error)); if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused) { - LogMessage("[META] Failed to load plugin %s. %s", buffer, error); + mm_LogMessage("[META] Failed to load plugin %s. %s", buffer, error); } else { if (already) - { skipped++; - } else - { total++; - } } } else @@ -626,31 +622,23 @@ mm_LoadPluginsFromFile(const char *_file) id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error)); if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused) { - LogMessage("[META] Failed to load plugin %s. %s", buffer, error); + mm_LogMessage("[META] Failed to load plugin %s. %s", buffer, error); } else { if (already) - { skipped++; - } else - { total++; - } } } } fclose(fp); if (skipped) - { - LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped); - } + mm_LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped); else - { - LogMessage("[META] Loaded %d plugins from file.", total); - } + mm_LogMessage("[META] Loaded %d plugins from file.", total); return total; } @@ -958,7 +946,7 @@ void MetamodSource::LogMsg(ISmmPlugin *pl, const char *msg, ...) UTIL_FormatArgs(buffer, sizeof(buffer), msg, ap); va_end(ap); - LogMessage("[%s] %s", pl->GetLogTag(), buffer); + mm_LogMessage("[%s] %s", pl->GetLogTag(), buffer); } CreateInterfaceFn MetamodSource::GetEngineFactory(bool syn/* =true */) @@ -1434,20 +1422,14 @@ ProcessVDF(const char *path) char alias[24], file[255], error[255]; if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias))) - { return; - } if (alias[0] != '\0') - { g_PluginMngr.SetAlias(alias, file); - } id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error)); if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused) - { - LogMessage("[META] Failed to load plugin %s: %s", file, error); - } + mm_LogMessage("[META] Failed to load plugin %s: %s", file, error); } static void @@ -1472,7 +1454,7 @@ LookForVDFs(const char *dir) error, sizeof(error), NULL); - LogMessage("[META] Could not open folder \"%s\" (%s)", dir, error); + mm_LogMessage("[META] Could not open folder \"%s\" (%s)", dir, error); return; } @@ -1499,7 +1481,7 @@ LookForVDFs(const char *dir) if ((pDir = opendir(dir)) == NULL) { - LogMessage("[META] Could not open folder \"%s\" (%s)", dir, strerror(errno)); + mm_LogMessage("[META] Could not open folder \"%s\" (%s)", dir, strerror(errno)); return; } diff --git a/core/metamod_util.h b/core/metamod_util.h index b89c8af..de003e1 100644 --- a/core/metamod_util.h +++ b/core/metamod_util.h @@ -95,6 +95,5 @@ bool UTIL_Relatize(char buffer[], const char *relTo, const char *relFrom); -void LogMessage(const char *msg, ...); - #endif //_INCLUDE_UTIL_H + diff --git a/core/provider/provider_ep2.cpp b/core/provider/provider_ep2.cpp index c982645..3b31e4d 100644 --- a/core/provider/provider_ep2.cpp +++ b/core/provider/provider_ep2.cpp @@ -41,6 +41,7 @@ #include "metamod_console.h" #include "vsp_listener.h" #include +#include "metamod.h" /* Types */ typedef void (*CONPRINTF_FUNC)(const char *, ...); @@ -64,17 +65,18 @@ void ClientCommand(edict_t *pEdict, const CCommand &args); void LocalCommand_Meta(const CCommand &args); void _ServerCommand(); /* Variables */ -bool usermsgs_extracted = false; -CVector usermsgs_list; +static bool usermsgs_extracted = false; +static CVector usermsgs_list; +static VSPListener g_VspListener; +static BaseProvider g_Ep1Provider; +static List conbases_unreg; + ICvar *icvar = NULL; -ISmmAPI *metamod_api = NULL; +IFileSystem *baseFs = NULL; +IServerGameDLL *server = NULL; IVEngineServer *engine = NULL; IServerGameClients *gameclients = NULL; -VSPListener g_VspListener; -BaseProvider g_Ep1Provider; IMetamodSourceProvider *provider = &g_Ep1Provider; -List conbases_unreg; -IFileSystem *baseFs = NULL; ConCommand meta_local_cmd("meta", LocalCommand_Meta, "Metamod:Source control options"); SH_DECL_HOOK2_void(IServerGameClients, ClientCommand, SH_NOATTRIB, 0, edict_t *, const CCommand &); @@ -126,7 +128,7 @@ void BaseProvider::Notify_DLLInit_Pre(CreateInterfaceFn engineFactory, baseFs = (IFileSystem *)((engineFactory)(FILESYSTEM_INTERFACE_VERSION, NULL)); if (baseFs == NULL) { - ::LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION); + mm_LogMessage("Unable to find \"%s\": .vdf files will not be parsed", FILESYSTEM_INTERFACE_VERSION); return; }