Moved adding of FCVAR_GAMEDLL to Unload; added SourceHook iface/impl info to meta version mmsource-1.00-RC1
authorPavol Marko <pavolmarko@gmail.com>
Fri May 06 09:44:41 2005 +0000 (2005-05-06)
changeset 63ee7abd0da4dd
parent 62 90513b7e3d99
child 64 ad98b9f2d80c
Moved adding of FCVAR_GAMEDLL to Unload; added SourceHook iface/impl info to meta version
sourcemm/concommands.cpp
sourcemm/concommands.h
sourcemm/sourcemm.cpp
     1.1 --- a/sourcemm/concommands.cpp	Thu May 05 21:02:31 2005 +0000
     1.2 +++ b/sourcemm/concommands.cpp	Fri May 06 09:44:41 2005 +0000
     1.3 @@ -22,13 +22,27 @@
     1.4  {
     1.5  	// Add the FCVAR_GAMEDLL flag 
     1.6  	// => No crash on exit!
     1.7 -	pCommand->AddFlags(FCVAR_GAMEDLL);
     1.8 +	// UPDATE: Do _not_ add the FCVAR_GAMEDLL flag here, as it
     1.9 +	// causes the command to be unusable on listenservers until you load a map
    1.10 +	// We will set the FCVAR_GAMEDLL flag on all commands we have registered once we are being unloaded
    1.11 +	//pCommand->AddFlags(FCVAR_GAMEDLL);
    1.12 +	m_RegisteredCommands.push_back(pCommand);
    1.13 +
    1.14  	pCommand->SetNext( NULL );
    1.15  	g_Engine.icvar->RegisterConCommandBase(pCommand);
    1.16  
    1.17  	return true;
    1.18  }
    1.19  
    1.20 +void SMConVarAccessor::MarkCommandsAsGameDLL()
    1.21 +{
    1.22 +	for (std::list<ConCommandBase*>::iterator iter = m_RegisteredCommands.begin();
    1.23 +		iter != m_RegisteredCommands.end(); ++iter)
    1.24 +	{
    1.25 +		(*iter)->AddFlags(FCVAR_GAMEDLL);
    1.26 +	}
    1.27 +}
    1.28 +
    1.29  ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY, "Metamod:Source Version");
    1.30  
    1.31  CON_COMMAND(meta, "Metamod:Source Menu")
    1.32 @@ -54,6 +68,7 @@
    1.33  			Msg("Metamod:Source version %s\n", SOURCEMM_VERSION);
    1.34  			Msg("Compiled on: %s\n", SOURCEMM_DATE);
    1.35  			Msg("Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
    1.36 +			Msg("SourceHook version: %d:%d\n", g_SourceHook.GetIfaceVersion(), g_SourceHook.GetImplVersion());
    1.37  			Msg("http://www.sourcemm.net/\n\n");
    1.38  
    1.39  			return;
     2.1 --- a/sourcemm/concommands.h	Thu May 05 21:02:31 2005 +0000
     2.2 +++ b/sourcemm/concommands.h	Fri May 06 09:44:41 2005 +0000
     2.3 @@ -20,11 +20,14 @@
     2.4  #include <eiface.h>
     2.5  #include "sourcemm.h"
     2.6  #include <convar.h>
     2.7 +#include <list>
     2.8  
     2.9  class SMConVarAccessor : public IConCommandBaseAccessor
    2.10  {
    2.11 +	std::list<ConCommandBase*> m_RegisteredCommands;
    2.12  public:
    2.13  	virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
    2.14 +	void MarkCommandsAsGameDLL();
    2.15  };
    2.16  
    2.17  extern SMConVarAccessor g_SMConVarAccessor;
     3.1 --- a/sourcemm/sourcemm.cpp	Thu May 05 21:02:31 2005 +0000
     3.2 +++ b/sourcemm/sourcemm.cpp	Fri May 06 09:44:41 2005 +0000
     3.3 @@ -289,6 +289,9 @@
     3.4  
     3.5  	// Shutdown sourcehook now
     3.6  	g_SourceHook.CompleteShutdown();
     3.7 +
     3.8 +	// Add the FCVAR_GAMEDLL flag to our cvars so the engine removes them properly
     3.9 +	g_SMConVarAccessor.MarkCommandsAsGameDLL();
    3.10  }
    3.11  
    3.12  int LoadPluginsFromFile(const char *file)