1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

Added new cvar, mm_pluginsfile

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4090
This commit is contained in:
David Anderson 2005-07-07 20:58:05 +00:00
parent 542dfc5eec
commit 400f0a9fab
3 changed files with 17 additions and 4 deletions

View File

@ -84,6 +84,11 @@ void SMConVarAccessor::Unregister(ConCommandBase *pCommand)
}
ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
#if defined WIN32 || defined _WIN32
ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
#else
ConVar mm_pluginsfile("mm_pluginsfile", "addons/metamod/metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
#endif
CON_COMMAND(meta, "Metamod:Source Menu")
{
@ -517,3 +522,9 @@ void CAlwaysRegisterableCommand::BringToFront()
m_pICvar->RegisterConCommandBase(this);
}
}
const char *GetPluginsFile()
{
return mm_pluginsfile.GetString();
}

View File

@ -43,6 +43,8 @@ public:
void BringToFront();
};
const char *GetPluginsFile();
extern SMConVarAccessor g_SMConVarAccessor;
#endif //_INCLUDE_CONCOMMANDS_H

View File

@ -231,9 +231,9 @@ bool CServerGameDLL::DLLInit(CreateInterfaceFn engineFactory, CreateInterfaceFn
//Now it's safe to load plugins.
#if defined WIN32 || defined _WIN32
snprintf(full_path, sizeof(full_path)-1, "%s\\addons\\metamod\\%s", g_ModPath.c_str(), "metaplugins.ini");
snprintf(full_path, sizeof(full_path)-1, "%s\\%s", g_ModPath.c_str(), GetPluginsFile());
#else
snprintf(full_path, sizeof(full_path)-1, "%s/addons/metamod/%s", g_ModPath.c_str(), "metaplugins.ini");
snprintf(full_path, sizeof(full_path)-1, "%s/%s", g_ModPath.c_str(), GetPluginsFile());
#endif
LoadPluginsFromFile(full_path);
@ -290,7 +290,7 @@ void Shutdown()
#elif defined __linux__
void __attribute__ ((destructor)) app_fini(void)
{
if (!bInShutdown())
if (!bInShutdown)
Shutdown();
if (g_GameDll.lib && g_GameDll.loaded)
dlclose(g_GameDll.lib);
@ -338,7 +338,7 @@ int LoadPluginsFromFile(const char *file)
UTIL_TrimLeft(buffer);
UTIL_TrimRight(buffer);
if (buffer[0] == NULL || buffer[0] == ';' || strncmp(buffer, "//", 2) == 0)
if (buffer[0] == '\0' || buffer[0] == ';' || strncmp(buffer, "//", 2) == 0)
continue;
//First find if it's an absolute path or not...
if (buffer[0] == '/' || strncmp(&(buffer[1]), ":\\", 2) == 0)