mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-11-28 10:24:20 +01:00
Added experimental code for cvar management
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4065
This commit is contained in:
parent
8f5e99397d
commit
8ba6224916
@ -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<IConCommandBaseAccessor *>(&g_SMConVarAccessor);
|
||||
}
|
||||
|
||||
void CSmmAPI::UnregisterCvar(ConCommandBase *pCvar)
|
||||
{
|
||||
g_SMConVarAccessor.Unregister(pCvar);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <interface.h>
|
||||
#include <eiface.h>
|
||||
#include <convar.h>
|
||||
#include <sourcehook/sourcehook.h>
|
||||
#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
|
||||
|
@ -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<ConCommandBase *>(ptr->GetNext());
|
||||
if (pNext == pCvar)
|
||||
break;
|
||||
ptr = pNext;
|
||||
}
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
ptr->SetNext(const_cast<ConCommandBase *>(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")
|
||||
|
@ -28,6 +28,7 @@ class SMConVarAccessor : public IConCommandBaseAccessor
|
||||
public:
|
||||
virtual bool RegisterConCommandBase(ConCommandBase *pCommand);
|
||||
void MarkCommandsAsGameDLL();
|
||||
void Unregister(ConCommandBase *pCvar);
|
||||
};
|
||||
|
||||
extern SMConVarAccessor g_SMConVarAccessor;
|
||||
|
@ -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__
|
||||
|
||||
/**
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user