Factor irrelevant stuff out of RootConsoleMenu.
This commit is contained in:
parent
ecbcc7ba16
commit
e992c33f35
@ -40,7 +40,6 @@ RootConsoleMenu g_RootMenu;
|
||||
|
||||
RootConsoleMenu::RootConsoleMenu()
|
||||
{
|
||||
m_CfgExecDone = false;
|
||||
}
|
||||
|
||||
RootConsoleMenu::~RootConsoleMenu()
|
||||
@ -55,10 +54,6 @@ RootConsoleMenu::~RootConsoleMenu()
|
||||
|
||||
void RootConsoleMenu::OnSourceModStartup(bool late)
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
g_pCVar = icvar;
|
||||
#endif
|
||||
CONVAR_REGISTER(this);
|
||||
AddRootConsoleCommand("version", "Display version information", this);
|
||||
AddRootConsoleCommand("credits", "Display credits listing", this);
|
||||
}
|
||||
@ -74,20 +69,6 @@ void RootConsoleMenu::OnSourceModShutdown()
|
||||
RemoveRootConsoleCommand("version", this);
|
||||
}
|
||||
|
||||
bool RootConsoleMenu::RegisterConCommandBase(ConCommandBase *pCommand)
|
||||
{
|
||||
META_REGCVAR(pCommand);
|
||||
|
||||
/* Override values of convars created by SourceMod convar manager if specified on command line */
|
||||
const char *cmdLineValue = icvar->GetCommandLineValue(pCommand->GetName());
|
||||
if (cmdLineValue && !pCommand->IsCommand())
|
||||
{
|
||||
static_cast<ConVar *>(pCommand)->SetValue(cmdLineValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RootConsoleMenu::ConsolePrint(const char *fmt, ...)
|
||||
{
|
||||
char buffer[512];
|
||||
|
@ -57,7 +57,6 @@ struct ConsoleEntry
|
||||
};
|
||||
|
||||
class RootConsoleMenu :
|
||||
public IConCommandBaseAccessor,
|
||||
public SMGlobalClass,
|
||||
public IRootConsoleCommand,
|
||||
public IRootConsole
|
||||
@ -68,8 +67,6 @@ public:
|
||||
public:
|
||||
const char *GetInterfaceName();
|
||||
unsigned int GetInterfaceVersion();
|
||||
public: //IConCommandBaseAccessor
|
||||
bool RegisterConCommandBase(ConCommandBase *pCommand);
|
||||
public: //SMGlobalClass
|
||||
void OnSourceModStartup(bool late);
|
||||
void OnSourceModAllInitialized();
|
||||
@ -91,7 +88,6 @@ public: //IRootConsole
|
||||
public:
|
||||
void GotRootCmd(const CCommand &cmd);
|
||||
private:
|
||||
bool m_CfgExecDone;
|
||||
NameHashSet<ConsoleEntry *> m_Commands;
|
||||
List<ConsoleEntry *> m_Menu;
|
||||
};
|
||||
|
@ -62,6 +62,7 @@ IGameConfig *g_pGameConf = NULL;
|
||||
bool g_Loaded = false;
|
||||
bool sm_show_debug_spew = false;
|
||||
bool sm_disable_jit = false;
|
||||
SMGlobalClass *SMGlobalClass::head = nullptr;
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
ConVar sm_basepath("sm_basepath", "addons\\sourcemod", 0, "SourceMod base path (set via command line)");
|
||||
@ -751,5 +752,29 @@ bool SourceModBase::IsMapRunning()
|
||||
return g_OnMapStarted;
|
||||
}
|
||||
|
||||
SMGlobalClass *SMGlobalClass::head = NULL;
|
||||
class ConVarRegistrar :
|
||||
public IConCommandBaseAccessor,
|
||||
public SMGlobalClass
|
||||
{
|
||||
public:
|
||||
void OnSourceModStartup(bool late) override
|
||||
{
|
||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||
g_pCVar = icvar;
|
||||
#endif
|
||||
CONVAR_REGISTER(this);
|
||||
}
|
||||
|
||||
bool RegisterConCommandBase(ConCommandBase *pCommand) override
|
||||
{
|
||||
META_REGCVAR(pCommand);
|
||||
|
||||
// Override values of convars created by SourceMod convar manager if
|
||||
// specified on command line.
|
||||
const char *cmdLineValue = icvar->GetCommandLineValue(pCommand->GetName());
|
||||
if (cmdLineValue && !pCommand->IsCommand())
|
||||
static_cast<ConVar *>(pCommand)->SetValue(cmdLineValue);
|
||||
|
||||
return true;
|
||||
}
|
||||
} sConVarRegistrar;
|
||||
|
Loading…
Reference in New Issue
Block a user