sourcemm/concommands.cpp
changeset 64 ad98b9f2d80c
parent 63 ee7abd0da4dd
child 65 27c4d32394a6
     1.1 --- a/sourcemm/concommands.cpp	Fri May 06 09:44:41 2005 +0000
     1.2 +++ b/sourcemm/concommands.cpp	Mon May 16 20:15:57 2005 +0000
     1.3 @@ -43,6 +43,34 @@
     1.4  	}
     1.5  }
     1.6  
     1.7 +void SMConVarAccessor::Unregister(ConCommandBase *pCvar)
     1.8 +{
     1.9 +	ICvar *cv = g_Engine.icvar;
    1.10 +
    1.11 +	ConCommandBase *ptr = cv->GetCommands();
    1.12 +
    1.13 +	if (ptr == pCvar && ptr->GetNext())
    1.14 +	{
    1.15 +		//we're at the beginning of the list
    1.16 +		*ptr = *(ptr->GetNext());
    1.17 +		return;
    1.18 +	}
    1.19 +
    1.20 +	while (ptr)
    1.21 +	{
    1.22 +		ConCommandBase *pNext = const_cast<ConCommandBase *>(ptr->GetNext());
    1.23 +		if (pNext == pCvar)
    1.24 +			break;
    1.25 +		ptr = pNext;
    1.26 +	}
    1.27 +
    1.28 +	if (ptr)
    1.29 +	{
    1.30 +		ptr->SetNext(const_cast<ConCommandBase *>(pCvar->GetNext()));
    1.31 +		pCvar->SetNext(NULL);
    1.32 +	}
    1.33 +}
    1.34 +
    1.35  ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY, "Metamod:Source Version");
    1.36  
    1.37  CON_COMMAND(meta, "Metamod:Source Menu")