mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-12-07 18:38:30 +00: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:
parent
818c3990e9
commit
8f5e99397d
@ -22,13 +22,27 @@ bool SMConVarAccessor::RegisterConCommandBase(ConCommandBase *pCommand)
|
|||||||
{
|
{
|
||||||
// Add the FCVAR_GAMEDLL flag
|
// Add the FCVAR_GAMEDLL flag
|
||||||
// => No crash on exit!
|
// => 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 );
|
pCommand->SetNext( NULL );
|
||||||
g_Engine.icvar->RegisterConCommandBase(pCommand);
|
g_Engine.icvar->RegisterConCommandBase(pCommand);
|
||||||
|
|
||||||
return true;
|
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");
|
ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY, "Metamod:Source Version");
|
||||||
|
|
||||||
CON_COMMAND(meta, "Metamod:Source Menu")
|
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("Metamod:Source version %s\n", SOURCEMM_VERSION);
|
||||||
Msg("Compiled on: %s\n", SOURCEMM_DATE);
|
Msg("Compiled on: %s\n", SOURCEMM_DATE);
|
||||||
Msg("Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
|
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");
|
Msg("http://www.sourcemm.net/\n\n");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -20,11 +20,14 @@
|
|||||||
#include <eiface.h>
|
#include <eiface.h>
|
||||||
#include "sourcemm.h"
|
#include "sourcemm.h"
|
||||||
#include <convar.h>
|
#include <convar.h>
|
||||||
|
#include <list>
|
||||||
|
|
||||||
class SMConVarAccessor : public IConCommandBaseAccessor
|
class SMConVarAccessor : public IConCommandBaseAccessor
|
||||||
{
|
{
|
||||||
|
std::list<ConCommandBase*> m_RegisteredCommands;
|
||||||
public:
|
public:
|
||||||
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
|
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
|
||||||
|
void MarkCommandsAsGameDLL();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SMConVarAccessor g_SMConVarAccessor;
|
extern SMConVarAccessor g_SMConVarAccessor;
|
||||||
|
|||||||
@ -289,6 +289,9 @@ void CServerGameDLL::DLLShutdown()
|
|||||||
|
|
||||||
// Shutdown sourcehook now
|
// Shutdown sourcehook now
|
||||||
g_SourceHook.CompleteShutdown();
|
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)
|
int LoadPluginsFromFile(const char *file)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user