sourcemm/concommands.cpp
changeset 114 6dcc66e9c3cc
parent 98 4c46acf7e76f
child 124 b04971393ee4
     1.1 --- a/sourcemm/concommands.cpp	Sat Sep 24 15:56:40 2005 +0000
     1.2 +++ b/sourcemm/concommands.cpp	Sat Sep 24 21:10:53 2005 +0000
     1.3 @@ -84,6 +84,37 @@
     1.4  	}
     1.5  }
     1.6  
     1.7 +void SMConVarAccessor::UnregisterGameDLLCommands()
     1.8 +{
     1.9 +	ConCommandBase *begin = g_Engine.icvar->GetCommands();
    1.10 +	ConCommandBase *iter = begin;
    1.11 +	ConCommandBase *prev = NULL;
    1.12 +	while (iter)
    1.13 +	{
    1.14 +		// watch out for the ETERNAL COMMAND!
    1.15 +		if (iter != &g_EternalCommand && iter->IsBitSet(FCVAR_GAMEDLL))
    1.16 +		{
    1.17 +			// Remove it!
    1.18 +			if (iter == begin)
    1.19 +			{
    1.20 +				g_EternalCommand.BringToFront();
    1.21 +				iter = const_cast<ConCommandBase*>(iter->GetNext());
    1.22 +				g_EternalCommand.SetNext(iter);
    1.23 +				prev = &g_EternalCommand;
    1.24 +				continue;
    1.25 +			}
    1.26 +			else
    1.27 +			{
    1.28 +				iter = const_cast<ConCommandBase*>(iter->GetNext());
    1.29 +				prev->SetNext(iter);
    1.30 +				continue;
    1.31 +			}
    1.32 +		}
    1.33 +		prev = iter;
    1.34 +		iter = const_cast<ConCommandBase*>(iter->GetNext());
    1.35 +	}
    1.36 +}
    1.37 +
    1.38  ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
    1.39  #if defined WIN32 || defined _WIN32
    1.40  ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");