mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-19 08:52:34 +01:00
Make ConVars opaque outside of providers
This commit is contained in:
parent
522d8f2034
commit
b336c9c30d
@ -77,9 +77,9 @@ static bool is_game_init = false;
|
||||
static bool vsp_load_requested = false;
|
||||
static bool vsp_loaded = false;
|
||||
static game_dll_t gamedll_info;
|
||||
static ConVar *metamod_version = NULL;
|
||||
static ConVar *mm_pluginsfile = NULL;
|
||||
static ConVar *mm_basedir = NULL;
|
||||
static MetamodSourceConVar *metamod_version = NULL;
|
||||
static MetamodSourceConVar *mm_pluginsfile = NULL;
|
||||
static MetamodSourceConVar *mm_basedir = NULL;
|
||||
static CreateInterfaceFn engine_factory = NULL;
|
||||
static CreateInterfaceFn physics_factory = NULL;
|
||||
static CreateInterfaceFn filesystem_factory = NULL;
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
namespace SourceMM
|
||||
{
|
||||
class MetamodSourceConVar;
|
||||
|
||||
enum
|
||||
{
|
||||
ConVarFlag_None = 0,
|
||||
@ -219,7 +221,7 @@ namespace SourceMM
|
||||
* @param help Help text.
|
||||
* @return ConVar pointer.
|
||||
*/
|
||||
virtual ConVar *CreateConVar(const char *name,
|
||||
virtual MetamodSourceConVar *CreateConVar(const char *name,
|
||||
const char *defval,
|
||||
const char *help,
|
||||
int flags) =0;
|
||||
@ -230,7 +232,7 @@ namespace SourceMM
|
||||
* @param convar ConVar pointer.
|
||||
* @return String value.
|
||||
*/
|
||||
virtual const char *GetConVarString(ConVar *convar) =0;
|
||||
virtual const char *GetConVarString(MetamodSourceConVar *convar) =0;
|
||||
|
||||
/**
|
||||
* @brief Sets a ConVar string.
|
||||
@ -238,7 +240,7 @@ namespace SourceMM
|
||||
* @param convar ConVar pointer.
|
||||
* @param str String pointer.
|
||||
*/
|
||||
virtual void SetConVarString(ConVar *convar, const char *str) =0;
|
||||
virtual void SetConVarString(MetamodSourceConVar *convar, const char *str) =0;
|
||||
|
||||
/**
|
||||
* @brief Retrieves the absolute path to the game directory.
|
||||
|
@ -61,13 +61,13 @@ public: // Must implement
|
||||
virtual void ConsolePrint(const char* msg) override = 0;
|
||||
virtual void ClientConsolePrint(edict_t* client, const char* msg) override = 0;
|
||||
virtual void ServerCommand(const char* cmd) override = 0;
|
||||
virtual ConVar* CreateConVar(const char* name,
|
||||
virtual MetamodSourceConVar *CreateConVar(const char* name,
|
||||
const char* defval,
|
||||
const char* help,
|
||||
int flags) override = 0;
|
||||
virtual const char* GetConVarString(ConVar* convar) override = 0;
|
||||
virtual void SetConVarString(ConVar* convar, const char* str) override = 0;
|
||||
virtual IConCommandBaseAccessor* GetConCommandBaseAccessor() override = 0;
|
||||
virtual const char* GetConVarString(MetamodSourceConVar *convar) override = 0;
|
||||
virtual void SetConVarString(MetamodSourceConVar *convar, const char* str) override = 0;
|
||||
virtual bool RegisterConCommandBase(ConCommandBase* pCommand) override = 0;
|
||||
virtual void UnregisterConCommandBase(ConCommandBase* pCommand) override = 0;
|
||||
virtual bool IsConCommandBaseACommand(ConCommandBase* pCommand) override = 0;
|
||||
|
@ -339,19 +339,19 @@ void SourceProvider::ServerCommand(const char* cmd)
|
||||
engine->ServerCommand(cmd);
|
||||
}
|
||||
|
||||
const char* SourceProvider::GetConVarString(ConVar* convar)
|
||||
const char* SourceProvider::GetConVarString(MetamodSourceConVar *convar)
|
||||
{
|
||||
if (convar == NULL)
|
||||
if (nullptr == convar)
|
||||
{
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return convar->GetString();
|
||||
return reinterpret_cast<ConVar *>(convar)->GetString();
|
||||
}
|
||||
|
||||
void SourceProvider::SetConVarString(ConVar* convar, const char* str)
|
||||
void SourceProvider::SetConVarString(MetamodSourceConVar *convar, const char* str)
|
||||
{
|
||||
convar->SetValue(str);
|
||||
reinterpret_cast<ConVar *>(convar)->SetValue(str);
|
||||
}
|
||||
|
||||
bool SourceProvider::IsConCommandBaseACommand(ConCommandBase* pCommand)
|
||||
@ -374,7 +374,7 @@ void SourceProvider::UnregisterConCommandBase(ConCommandBase* pCommand)
|
||||
return m_ConVarAccessor.Unregister(pCommand);
|
||||
}
|
||||
|
||||
ConVar* SourceProvider::CreateConVar(const char* name,
|
||||
MetamodSourceConVar* SourceProvider::CreateConVar(const char* name,
|
||||
const char* defval,
|
||||
const char* help,
|
||||
int flags)
|
||||
@ -393,7 +393,7 @@ ConVar* SourceProvider::CreateConVar(const char* name,
|
||||
|
||||
m_ConVarAccessor.RegisterConCommandBase(pVar);
|
||||
|
||||
return pVar;
|
||||
return reinterpret_cast<MetamodSourceConVar *>(pVar);
|
||||
}
|
||||
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
|
@ -46,13 +46,13 @@ public: // BaseProvider
|
||||
virtual void ConsolePrint(const char* msg) override;
|
||||
virtual void ClientConsolePrint(edict_t* client, const char* msg) override;
|
||||
virtual void ServerCommand(const char* cmd) override;
|
||||
virtual ConVar* CreateConVar(const char* name,
|
||||
virtual MetamodSourceConVar *CreateConVar(const char* name,
|
||||
const char* defval,
|
||||
const char* help,
|
||||
int flags) override;
|
||||
virtual const char* GetConVarString(ConVar* convar) override;
|
||||
virtual void SetConVarString(ConVar* convar, const char* str) override;
|
||||
virtual IConCommandBaseAccessor* GetConCommandBaseAccessor() override;
|
||||
virtual const char* GetConVarString(MetamodSourceConVar *convar) override;
|
||||
virtual void SetConVarString(MetamodSourceConVar *convar, const char* str) override;
|
||||
virtual bool RegisterConCommandBase(ConCommandBase* pCommand) override;
|
||||
virtual void UnregisterConCommandBase(ConCommandBase* pCommand) override;
|
||||
virtual bool IsConCommandBaseACommand(ConCommandBase* pCommand) override;
|
||||
|
@ -242,7 +242,7 @@ void Source2Provider::ServerCommand(const char* cmd)
|
||||
engine->ServerCommand(cmd);
|
||||
}
|
||||
|
||||
const char* Source2Provider::GetConVarString(ConVar* convar)
|
||||
const char* Source2Provider::GetConVarString(MetamodSourceConVar *convar)
|
||||
{
|
||||
#ifdef S2_CONVAR_UNFINISHED
|
||||
if (convar == NULL)
|
||||
@ -256,7 +256,7 @@ const char* Source2Provider::GetConVarString(ConVar* convar)
|
||||
#endif
|
||||
}
|
||||
|
||||
void Source2Provider::SetConVarString(ConVar* convar, const char* str)
|
||||
void Source2Provider::SetConVarString(MetamodSourceConVar *convar, const char* str)
|
||||
{
|
||||
#ifdef S2_CONVAR_UNFINISHED
|
||||
convar->SetValue(str);
|
||||
@ -297,7 +297,7 @@ void Source2Provider::UnregisterConCommandBase(ConCommandBase* pCommand)
|
||||
#endif
|
||||
}
|
||||
|
||||
ConVar* Source2Provider::CreateConVar(const char* name,
|
||||
MetamodSourceConVar* Source2Provider::CreateConVar(const char* name,
|
||||
const char* defval,
|
||||
const char* help,
|
||||
int flags)
|
||||
|
@ -53,13 +53,13 @@ public:
|
||||
virtual void ConsolePrint(const char* msg) override;
|
||||
virtual void ClientConsolePrint(edict_t* client, const char* msg) override;
|
||||
virtual void ServerCommand(const char* cmd) override;
|
||||
virtual ConVar* CreateConVar(const char* name,
|
||||
virtual MetamodSourceConVar *CreateConVar(const char* name,
|
||||
const char* defval,
|
||||
const char* help,
|
||||
int flags) override;
|
||||
virtual const char* GetConVarString(ConVar* convar) override;
|
||||
virtual void SetConVarString(ConVar* convar, const char* str) override;
|
||||
virtual IConCommandBaseAccessor* GetConCommandBaseAccessor() override;
|
||||
virtual const char* GetConVarString(MetamodSourceConVar *convar) override;
|
||||
virtual void SetConVarString(MetamodSourceConVar *convar, const char* str) override;
|
||||
virtual bool RegisterConCommandBase(ConCommandBase* pCommand) override;
|
||||
virtual void UnregisterConCommandBase(ConCommandBase* pCommand) override;
|
||||
virtual bool IsConCommandBaseACommand(ConCommandBase* pCommand) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user