1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-02-20 13:54:14 +01:00

Moved adding of FCVAR_GAMEDLL to Unload; added SourceHook iface/impl info to meta version

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4064
This commit is contained in:
Pavol Marko 2005-05-06 09:44:41 +00:00
parent 818c3990e9
commit 8f5e99397d
3 changed files with 22 additions and 1 deletions

View File

@ -22,13 +22,27 @@ bool SMConVarAccessor::RegisterConCommandBase(ConCommandBase *pCommand)
{
// Add the FCVAR_GAMEDLL flag
// => No crash on exit!
pCommand->AddFlags(FCVAR_GAMEDLL);
// UPDATE: Do _not_ add the FCVAR_GAMEDLL flag here, as it
// causes the command to be unusable on listenservers until you load a map
// We will set the FCVAR_GAMEDLL flag on all commands we have registered once we are being unloaded
//pCommand->AddFlags(FCVAR_GAMEDLL);
m_RegisteredCommands.push_back(pCommand);
pCommand->SetNext( NULL );
g_Engine.icvar->RegisterConCommandBase(pCommand);
return true;
}
void SMConVarAccessor::MarkCommandsAsGameDLL()
{
for (std::list<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
iter != m_RegisteredCommands.end(); ++iter)
{
(*iter)->AddFlags(FCVAR_GAMEDLL);
}
}
ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY, "Metamod:Source Version");
CON_COMMAND(meta, "Metamod:Source Menu")
@ -54,6 +68,7 @@ CON_COMMAND(meta, "Metamod:Source Menu")
Msg("Metamod:Source version %s\n", SOURCEMM_VERSION);
Msg("Compiled on: %s\n", SOURCEMM_DATE);
Msg("Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
Msg("SourceHook version: %d:%d\n", g_SourceHook.GetIfaceVersion(), g_SourceHook.GetImplVersion());
Msg("http://www.sourcemm.net/\n\n");
return;

View File

@ -20,11 +20,14 @@
#include <eiface.h>
#include "sourcemm.h"
#include <convar.h>
#include <list>
class SMConVarAccessor : public IConCommandBaseAccessor
{
std::list<ConCommandBase*> m_RegisteredCommands;
public:
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
void MarkCommandsAsGameDLL();
};
extern SMConVarAccessor g_SMConVarAccessor;

View File

@ -289,6 +289,9 @@ void CServerGameDLL::DLLShutdown()
// Shutdown sourcehook now
g_SourceHook.CompleteShutdown();
// Add the FCVAR_GAMEDLL flag to our cvars so the engine removes them properly
g_SMConVarAccessor.MarkCommandsAsGameDLL();
}
int LoadPluginsFromFile(const char *file)