diff --git a/sourcemm/CSmmAPI.cpp b/sourcemm/CSmmAPI.cpp index cf87f2c..32be2be 100644 --- a/sourcemm/CSmmAPI.cpp +++ b/sourcemm/CSmmAPI.cpp @@ -10,6 +10,7 @@ #include "CSmmAPI.h" #include "sourcemm.h" +#include "concommands.h" /** * @brief Implementation of main API interface @@ -86,3 +87,14 @@ META_RES CSmmAPI::GetLastMetaReturn() { return m_Res; } + +IConCommandBaseAccessor *CSmmAPI::GetCvarBaseAccessor() +{ + return static_cast(&g_SMConVarAccessor); +} + +void CSmmAPI::UnregisterCvar(ConCommandBase *pCvar) +{ + g_SMConVarAccessor.Unregister(pCvar); +} + diff --git a/sourcemm/CSmmAPI.h b/sourcemm/CSmmAPI.h index f9fb439..e8b5fe3 100644 --- a/sourcemm/CSmmAPI.h +++ b/sourcemm/CSmmAPI.h @@ -34,6 +34,8 @@ namespace SourceMM CGlobalVars *pGlobals(); void SetLastMetaReturn(META_RES res); META_RES GetLastMetaReturn(); + IConCommandBaseAccessor *GetCvarBaseAccessor(); + void UnregisterCvar(ConCommandBase *pCvar); private: META_RES m_Res; }; diff --git a/sourcemm/ISmmAPI.h b/sourcemm/ISmmAPI.h index 39dd3ed..a350d35 100644 --- a/sourcemm/ISmmAPI.h +++ b/sourcemm/ISmmAPI.h @@ -18,6 +18,7 @@ #include #include +#include #include #include "IPluginManager.h" @@ -38,6 +39,10 @@ public: virtual CGlobalVars *pGlobals() =0; virtual void SetLastMetaReturn(META_RES res) =0; virtual META_RES GetLastMetaReturn() =0; +public: + //Added in 1.00-RC2 to solve concommand problems + virtual IConCommandBaseAccessor *GetCvarBaseAccessor() =0; + virtual void UnregisterCvar(ConCommandBase *pCvar) =0; }; #endif //_INCLUDE_ISMM_API_H diff --git a/sourcemm/concommands.cpp b/sourcemm/concommands.cpp index 2602961..c4b3875 100644 --- a/sourcemm/concommands.cpp +++ b/sourcemm/concommands.cpp @@ -43,6 +43,34 @@ void SMConVarAccessor::MarkCommandsAsGameDLL() } } +void SMConVarAccessor::Unregister(ConCommandBase *pCvar) +{ + ICvar *cv = g_Engine.icvar; + + ConCommandBase *ptr = cv->GetCommands(); + + if (ptr == pCvar && ptr->GetNext()) + { + //we're at the beginning of the list + *ptr = *(ptr->GetNext()); + return; + } + + while (ptr) + { + ConCommandBase *pNext = const_cast(ptr->GetNext()); + if (pNext == pCvar) + break; + ptr = pNext; + } + + if (ptr) + { + ptr->SetNext(const_cast(pCvar->GetNext())); + pCvar->SetNext(NULL); + } +} + ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_REPLICATED | FCVAR_SPONLY, "Metamod:Source Version"); CON_COMMAND(meta, "Metamod:Source Menu") diff --git a/sourcemm/concommands.h b/sourcemm/concommands.h index a6b94be..eb095b1 100644 --- a/sourcemm/concommands.h +++ b/sourcemm/concommands.h @@ -28,6 +28,7 @@ class SMConVarAccessor : public IConCommandBaseAccessor public: virtual bool RegisterConCommandBase(ConCommandBase *pCommand); void MarkCommandsAsGameDLL(); + void Unregister(ConCommandBase *pCvar); }; extern SMConVarAccessor g_SMConVarAccessor; diff --git a/sourcemm/sourcemm.h b/sourcemm/sourcemm.h index df836f8..2b037a5 100644 --- a/sourcemm/sourcemm.h +++ b/sourcemm/sourcemm.h @@ -26,7 +26,7 @@ #include "oslink.h" #include "util.h" -#define SOURCEMM_VERSION "1.00-RC1" +#define SOURCEMM_VERSION "1.00-RC2" #define SOURCEMM_DATE __DATE__ /** diff --git a/sourcemm/version.rc b/sourcemm/version.rc index aaf7b1e..449be9d 100755 --- a/sourcemm/version.rc +++ b/sourcemm/version.rc @@ -27,8 +27,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 + FILEVERSION 1,0,0,2 + PRODUCTVERSION 1,0,0,2 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -45,12 +45,12 @@ BEGIN BEGIN VALUE "Comments", "Metamod: Source" VALUE "FileDescription", "Metamod: Source" - VALUE "FileVersion", "1.00-RC1" + VALUE "FileVersion", "1.00-RC2" VALUE "InternalName", "sourcemm" VALUE "LegalCopyright", "Copyright (c) 2004-2005, Metamod: Source Development Team" VALUE "OriginalFilename", "server.dll" VALUE "ProductName", "Metamod: Source" - VALUE "ProductVersion", "1.00-RC1" + VALUE "ProductVersion", "1.00-RC2" END END BLOCK "VarFileInfo"