Replace the AddRootConsoleCommand API to not expose internal structures.
This commit is contained in:
parent
e992c33f35
commit
9d805ea9fb
@ -66,7 +66,7 @@ ConCmdManager::~ConCmdManager()
|
||||
void ConCmdManager::OnSourceModAllInitialized()
|
||||
{
|
||||
scripts->AddPluginsListener(this);
|
||||
g_RootMenu.AddRootConsoleCommand("cmds", "List console commands", this);
|
||||
g_RootMenu.AddRootConsoleCommand3("cmds", "List console commands", this);
|
||||
SH_ADD_HOOK(IServerGameClients, SetCommandClient, serverClients, SH_MEMBER(this, &ConCmdManager::SetCommandClient), false);
|
||||
}
|
||||
|
||||
@ -634,11 +634,11 @@ ConCmdInfo *ConCmdManager::AddOrFindCommand(const char *name, const char *descri
|
||||
return pInfo;
|
||||
}
|
||||
|
||||
void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
|
||||
{
|
||||
if (command.ArgC() >= 3)
|
||||
if (command->ArgC() >= 3)
|
||||
{
|
||||
const char *text = command.Arg(2);
|
||||
const char *text = command->Arg(2);
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByConsoleArg(text);
|
||||
|
||||
|
@ -131,7 +131,7 @@ public: //SMGlobalClass
|
||||
public: //IPluginsListener
|
||||
void OnPluginDestroyed(IPlugin *plugin);
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command) override;
|
||||
public: //IConCommandTracker
|
||||
void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
|
||||
public:
|
||||
|
@ -134,7 +134,7 @@ void ConVarManager::OnSourceModAllInitialized()
|
||||
scripts->AddPluginsListener(this);
|
||||
|
||||
/* Add the 'convars' option to the 'sm' console command */
|
||||
g_RootMenu.AddRootConsoleCommand("cvars", "View convars created by a plugin", this);
|
||||
g_RootMenu.AddRootConsoleCommand3("cvars", "View convars created by a plugin", this);
|
||||
}
|
||||
|
||||
void ConVarManager::OnSourceModShutdown()
|
||||
@ -340,19 +340,19 @@ bool ConVarManager::GetHandleApproxSize(HandleType_t type, void *object, unsigne
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
void ConVarManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
|
||||
{
|
||||
int argcount = command.ArgC();
|
||||
int argcount = command->ArgC();
|
||||
if (argcount >= 3)
|
||||
{
|
||||
bool wantReset = false;
|
||||
|
||||
/* Get plugin index that was passed */
|
||||
const char *arg = command.Arg(2);
|
||||
const char *arg = command->Arg(2);
|
||||
if (argcount >= 4 && strcmp(arg, "reset") == 0)
|
||||
{
|
||||
wantReset = true;
|
||||
arg = command.Arg(3);
|
||||
arg = command->Arg(3);
|
||||
}
|
||||
|
||||
/* Get plugin object */
|
||||
|
@ -107,7 +107,7 @@ public: // IHandleTypeDispatch
|
||||
public: // IPluginsListener
|
||||
void OnPluginUnloaded(IPlugin *plugin);
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command) override;
|
||||
public: //IConCommandTracker
|
||||
void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
|
||||
public: //IClientListener
|
||||
|
@ -118,7 +118,7 @@ void CheckAndFinalizeConfigs()
|
||||
|
||||
void CoreConfig::OnSourceModAllInitialized()
|
||||
{
|
||||
g_RootMenu.AddRootConsoleCommand("config", "Set core configuration options", this);
|
||||
g_RootMenu.AddRootConsoleCommand3("config", "Set core configuration options", this);
|
||||
g_pOnServerCfg = forwardsys->CreateForward("OnServerCfg", ET_Ignore, 0, NULL);
|
||||
g_pOnConfigsExecuted = forwardsys->CreateForward("OnConfigsExecuted", ET_Ignore, 0, NULL);
|
||||
g_pOnAutoConfigsBuffered = forwardsys->CreateForward("OnAutoConfigsBuffered", ET_Ignore, 0, NULL);
|
||||
@ -184,13 +184,13 @@ void CoreConfig::OnSourceModLevelChange(const char *mapName)
|
||||
g_bGotTrigger = false;
|
||||
}
|
||||
|
||||
void CoreConfig::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
void CoreConfig::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
|
||||
{
|
||||
int argcount = command.ArgC();
|
||||
int argcount = command->ArgC();
|
||||
if (argcount >= 4)
|
||||
{
|
||||
const char *option = command.Arg(2);
|
||||
const char *value = command.Arg(3);
|
||||
const char *option = command->Arg(2);
|
||||
const char *value = command->Arg(3);
|
||||
|
||||
char error[255];
|
||||
|
||||
@ -207,7 +207,7 @@ void CoreConfig::OnRootConsoleCommand(const char *cmdname, const CCommand &comma
|
||||
|
||||
return;
|
||||
} else if (argcount >= 3) {
|
||||
const char *option = command.Arg(2);
|
||||
const char *option = command->Arg(2);
|
||||
|
||||
const char *value = GetCoreConfigValue(option);
|
||||
|
||||
|
@ -55,7 +55,7 @@ public: // SMGlobalClass
|
||||
public: // ITextListener_SMC
|
||||
SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
|
||||
public: // IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command) override;
|
||||
public:
|
||||
/**
|
||||
* Initializes CoreConfig by reading from core.cfg file
|
||||
|
@ -512,7 +512,7 @@ void CExtensionManager::OnSourceModAllInitialized()
|
||||
{
|
||||
g_ExtType = g_ShareSys.CreateIdentType("EXTENSION");
|
||||
pluginsys->AddPluginsListener(this);
|
||||
rootmenu->AddRootConsoleCommand("exts", "Manage extensions", this);
|
||||
rootmenu->AddRootConsoleCommand3("exts", "Manage extensions", this);
|
||||
g_ShareSys.AddInterface(NULL, this);
|
||||
}
|
||||
|
||||
@ -929,12 +929,12 @@ void CExtensionManager::AddDependency(IExtension *pSource, const char *file, boo
|
||||
}
|
||||
}
|
||||
|
||||
void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
|
||||
{
|
||||
int argcount = smcore.Argc(command);
|
||||
int argcount = command->ArgC();
|
||||
if (argcount >= 3)
|
||||
{
|
||||
const char *cmd = smcore.Arg(command, 2);
|
||||
const char *cmd = command->Arg(2);
|
||||
if (strcmp(cmd, "list") == 0)
|
||||
{
|
||||
List<CExtension *>::iterator iter;
|
||||
@ -990,7 +990,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
return;
|
||||
}
|
||||
|
||||
const char *filename = smcore.Arg(command, 3);
|
||||
const char *filename = command->Arg(3);
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
char error[256];
|
||||
|
||||
@ -1021,7 +1021,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
return;
|
||||
}
|
||||
|
||||
const char *sId = smcore.Arg(command, 3);
|
||||
const char *sId = command->Arg(3);
|
||||
unsigned int id = atoi(sId);
|
||||
if (id <= 0)
|
||||
{
|
||||
@ -1106,7 +1106,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
return;
|
||||
}
|
||||
|
||||
const char *arg = smcore.Arg(command, 3);
|
||||
const char *arg = command->Arg(3);
|
||||
unsigned int num = atoi(arg);
|
||||
CExtension *pExt = FindByOrder(num);
|
||||
|
||||
@ -1118,7 +1118,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
|
||||
if (argcount > 4 && pExt->unload_code)
|
||||
{
|
||||
const char *unload = smcore.Arg(command, 4);
|
||||
const char *unload = command->Arg(4);
|
||||
if (pExt->unload_code == (unsigned)atoi(unload))
|
||||
{
|
||||
char filename[PLATFORM_MAX_PATH];
|
||||
@ -1223,7 +1223,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
|
||||
return;
|
||||
}
|
||||
|
||||
const char *arg = smcore.Arg(command, 3);
|
||||
const char *arg = command->Arg(3);
|
||||
unsigned int num = atoi(arg);
|
||||
CExtension *pExt = FindByOrder(num);
|
||||
|
||||
|
@ -161,7 +161,7 @@ public: //IExtensionManager
|
||||
public: //IPluginsListener
|
||||
void OnPluginDestroyed(IPlugin *plugin);
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command) override;
|
||||
public:
|
||||
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
|
||||
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
|
||||
|
@ -900,8 +900,6 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **aResult, const char *path, bool de
|
||||
if (m_LoadingLocked)
|
||||
return LoadRes_NeverLoad;
|
||||
|
||||
int err;
|
||||
|
||||
/**
|
||||
* Does this plugin already exist?
|
||||
*/
|
||||
@ -1819,7 +1817,7 @@ void CPluginManager::OnSourceModAllInitialized()
|
||||
g_PluginType = handlesys->CreateType("Plugin", this, 0, NULL, &sec, m_MyIdent, NULL);
|
||||
g_PluginIdent = g_ShareSys.CreateIdentType("PLUGIN");
|
||||
|
||||
rootmenu->AddRootConsoleCommand("plugins", "Manage Plugins", this);
|
||||
rootmenu->AddRootConsoleCommand3("plugins", "Manage Plugins", this);
|
||||
|
||||
g_ShareSys.AddInterface(NULL, GetOldAPI());
|
||||
|
||||
@ -1941,12 +1939,12 @@ static inline bool IS_STR_FILLED(const char *text)
|
||||
return text[0] != '\0';
|
||||
}
|
||||
|
||||
void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
void CPluginManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
|
||||
{
|
||||
int argcount = smcore.Argc(command);
|
||||
int argcount = command->ArgC();
|
||||
if (argcount >= 3)
|
||||
{
|
||||
const char *cmd = smcore.Arg(command, 2);
|
||||
const char *cmd = command->Arg(2);
|
||||
if (strcmp(cmd, "list") == 0)
|
||||
{
|
||||
char buffer[256];
|
||||
@ -2035,7 +2033,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
char error[128];
|
||||
bool wasloaded;
|
||||
const char *filename = smcore.Arg(command, 3);
|
||||
const char *filename = command->Arg(3);
|
||||
|
||||
char pluginfile[256];
|
||||
const char *ext = libsys->GetFileExtension(filename) ? "" : ".smx";
|
||||
@ -2070,7 +2068,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
CPlugin *pl;
|
||||
char *end;
|
||||
const char *arg = smcore.Arg(command, 3);
|
||||
const char *arg = command->Arg(3);
|
||||
int id = strtol(arg, &end, 10);
|
||||
|
||||
if (*end == '\0')
|
||||
@ -2160,7 +2158,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
CPlugin *pl;
|
||||
char *end;
|
||||
const char *arg = smcore.Arg(command, 3);
|
||||
const char *arg = command->Arg(3);
|
||||
int id = strtol(arg, &end, 10);
|
||||
|
||||
if (*end == '\0')
|
||||
@ -2291,7 +2289,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c
|
||||
|
||||
CPlugin *pl;
|
||||
char *end;
|
||||
const char *arg = smcore.Arg(command, 3);
|
||||
const char *arg = command->Arg(3);
|
||||
int id = strtol(arg, &end, 10);
|
||||
|
||||
if (*end == '\0')
|
||||
|
@ -347,7 +347,7 @@ public: //IHandleTypeDispatch
|
||||
void OnHandleDestroy(HandleType_t type, void *object);
|
||||
bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command) override;
|
||||
public:
|
||||
/**
|
||||
* Loads all plugins not yet loaded
|
||||
|
@ -40,7 +40,7 @@ ProfileToolManager::ProfileToolManager()
|
||||
void
|
||||
ProfileToolManager::OnSourceModAllInitialized()
|
||||
{
|
||||
rootmenu->AddRootConsoleCommand2("prof", "Profiling", this);
|
||||
rootmenu->AddRootConsoleCommand3("prof", "Profiling", this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -95,7 +95,7 @@ ProfileToolManager::StartFromConsole(IProfilingTool *tool)
|
||||
}
|
||||
|
||||
void
|
||||
ProfileToolManager::OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *args)
|
||||
ProfileToolManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *args)
|
||||
{
|
||||
if (tools_.length() == 0) {
|
||||
rootmenu->ConsolePrint("No profiling tools are enabled.");
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
void OnSourceModShutdown() override;
|
||||
|
||||
// IRootConsoleCommand
|
||||
void OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *args) override;
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *args) override;
|
||||
|
||||
void RegisterTool(IProfilingTool *tool) {
|
||||
tools_.append(tool);
|
||||
|
@ -52,7 +52,7 @@ using namespace SourceHook;
|
||||
* Add 1 to the RHS of this expression to bump the intercom file
|
||||
* This is to prevent mismatching core/logic binaries
|
||||
*/
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 35)
|
||||
#define SM_LOGIC_MAGIC (0x0F47C0DE - 36)
|
||||
|
||||
#if defined SM_LOGIC
|
||||
class IVEngineServer
|
||||
|
@ -54,8 +54,8 @@ RootConsoleMenu::~RootConsoleMenu()
|
||||
|
||||
void RootConsoleMenu::OnSourceModStartup(bool late)
|
||||
{
|
||||
AddRootConsoleCommand("version", "Display version information", this);
|
||||
AddRootConsoleCommand("credits", "Display credits listing", this);
|
||||
AddRootConsoleCommand3("version", "Display version information", this);
|
||||
AddRootConsoleCommand3("credits", "Display credits listing", this);
|
||||
}
|
||||
|
||||
void RootConsoleMenu::OnSourceModAllInitialized()
|
||||
@ -92,18 +92,17 @@ void RootConsoleMenu::ConsolePrint(const char *fmt, ...)
|
||||
|
||||
bool RootConsoleMenu::AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler)
|
||||
{
|
||||
return _AddRootConsoleCommand(cmd, text, pHandler, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RootConsoleMenu::AddRootConsoleCommand2(const char *cmd, const char *text, IRootConsoleCommand *pHandler)
|
||||
{
|
||||
return _AddRootConsoleCommand(cmd, text, pHandler, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
bool RootConsoleMenu::AddRootConsoleCommand3(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler,
|
||||
bool version2)
|
||||
IRootConsoleCommand *pHandler)
|
||||
{
|
||||
if (m_Commands.contains(cmd))
|
||||
return false;
|
||||
@ -120,7 +119,6 @@ bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
ConsoleEntry *pNew = new ConsoleEntry;
|
||||
pNew->command.assign(cmd);
|
||||
pNew->description.assign(text);
|
||||
pNew->version2 = version2;
|
||||
pNew->cmd = pHandler;
|
||||
m_Commands.insert(cmd, pNew);
|
||||
m_Menu.insert(iter, pNew);
|
||||
@ -135,7 +133,6 @@ bool RootConsoleMenu::_AddRootConsoleCommand(const char *cmd,
|
||||
ConsoleEntry *pNew = new ConsoleEntry;
|
||||
pNew->command.assign(cmd);
|
||||
pNew->description.assign(text);
|
||||
pNew->version2 = version2;
|
||||
pNew->cmd = pHandler;
|
||||
m_Commands.insert(cmd, pNew);
|
||||
m_Menu.push_back(pNew);
|
||||
@ -235,18 +232,18 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
void RootConsoleMenu::GotRootCmd(const CCommand &cmd)
|
||||
void RootConsoleMenu::GotRootCmd(const ICommandArgs *cmd)
|
||||
{
|
||||
unsigned int argnum = cmd.ArgC();
|
||||
unsigned int argnum = cmd->ArgC();
|
||||
|
||||
if (argnum >= 2)
|
||||
{
|
||||
const char *cmdname = cmd.Arg(1);
|
||||
const char *cmdname = cmd->Arg(1);
|
||||
if (strcmp(cmdname, "internal") == 0)
|
||||
{
|
||||
if (argnum >= 3)
|
||||
{
|
||||
const char *arg = cmd.Arg(2);
|
||||
const char *arg = cmd->Arg(2);
|
||||
if (strcmp(arg, "1") == 0)
|
||||
{
|
||||
SM_ConfigsExecuted_Global();
|
||||
@ -255,26 +252,17 @@ void RootConsoleMenu::GotRootCmd(const CCommand &cmd)
|
||||
{
|
||||
if (argnum >= 4)
|
||||
{
|
||||
SM_ConfigsExecuted_Plugin(atoi(cmd.Arg(3)));
|
||||
SM_ConfigsExecuted_Plugin(atoi(cmd->Arg(3)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CCommandArgs ocmd(cmd);
|
||||
|
||||
ConsoleEntry *entry;
|
||||
if (m_Commands.retrieve(cmdname, &entry))
|
||||
{
|
||||
if (entry->version2)
|
||||
{
|
||||
entry->cmd->OnRootConsoleCommand2(cmdname, &ocmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
entry->cmd->OnRootConsoleCommand(cmdname, cmd);
|
||||
}
|
||||
entry->cmd->OnRootConsoleCommand(cmdname, cmd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -291,7 +279,7 @@ void RootConsoleMenu::GotRootCmd(const CCommand &cmd)
|
||||
}
|
||||
}
|
||||
|
||||
void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command)
|
||||
{
|
||||
if (strcmp(cmdname, "credits") == 0)
|
||||
{
|
||||
@ -332,7 +320,8 @@ CON_COMMAND(sm, "SourceMod Menu")
|
||||
#if SOURCE_ENGINE <= SE_DARKMESSIAH
|
||||
CCommand args;
|
||||
#endif
|
||||
g_RootMenu.GotRootCmd(args);
|
||||
CCommandArgs cargs(args);
|
||||
g_RootMenu.GotRootCmd(&cargs);
|
||||
}
|
||||
|
||||
FILE *g_pHndlLog = NULL;
|
||||
|
@ -47,7 +47,6 @@ struct ConsoleEntry
|
||||
{
|
||||
String command;
|
||||
String description;
|
||||
bool version2;
|
||||
IRootConsoleCommand *cmd;
|
||||
|
||||
static inline bool matches(const char *name, const ConsoleEntry *entry)
|
||||
@ -72,7 +71,7 @@ public: //SMGlobalClass
|
||||
void OnSourceModAllInitialized();
|
||||
void OnSourceModShutdown();
|
||||
public: //IRootConsoleCommand
|
||||
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
|
||||
void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *command);
|
||||
public: //IRootConsole
|
||||
bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler);
|
||||
bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler);
|
||||
@ -81,12 +80,11 @@ public: //IRootConsole
|
||||
bool AddRootConsoleCommand2(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler);
|
||||
bool _AddRootConsoleCommand(const char *cmd,
|
||||
bool AddRootConsoleCommand3(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler,
|
||||
bool version2);
|
||||
IRootConsoleCommand *pHandler);
|
||||
public:
|
||||
void GotRootCmd(const CCommand &cmd);
|
||||
void GotRootCmd(const ICommandArgs *cmd);
|
||||
private:
|
||||
NameHashSet<ConsoleEntry *> m_Commands;
|
||||
List<ConsoleEntry *> m_Menu;
|
||||
|
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#define SMINTERFACE_ROOTCONSOLE_NAME "IRootConsole"
|
||||
#define SMINTERFACE_ROOTCONSOLE_VERSION 2
|
||||
#define SMINTERFACE_ROOTCONSOLE_VERSION 3
|
||||
|
||||
class CCommand;
|
||||
|
||||
@ -82,13 +82,11 @@ namespace SourceMod
|
||||
class IRootConsoleCommand
|
||||
{
|
||||
public:
|
||||
virtual void OnRootConsoleCommand(const char *cmdname, const CCommand &command)
|
||||
{
|
||||
}
|
||||
virtual unsigned int GetApiVersion() const {
|
||||
return SMINTERFACE_ROOTCONSOLE_VERSION;
|
||||
}
|
||||
|
||||
virtual void OnRootConsoleCommand2(const char *cmdname, const ICommandArgs *args)
|
||||
{
|
||||
}
|
||||
virtual void OnRootConsoleCommand(const char *cmdname, const ICommandArgs *args) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -98,12 +96,12 @@ namespace SourceMod
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Adds a root console command handler. The command must be unique.
|
||||
* @brief Removed.
|
||||
*
|
||||
* @param cmd String containing the console command.
|
||||
* @param text Description text.
|
||||
* @param pHandler An IRootConsoleCommand pointer to handle the command.
|
||||
* @return True on success, false on too many commands or duplicate command.
|
||||
* @param cmd Unused.
|
||||
* @param text Unused.
|
||||
* @param pHandler Unused.
|
||||
* @return False.
|
||||
*/
|
||||
virtual bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler) =0;
|
||||
|
||||
@ -136,16 +134,26 @@ namespace SourceMod
|
||||
virtual void DrawGenericOption(const char *cmd, const char *text) =0;
|
||||
|
||||
/**
|
||||
* @brief Adds a root console command handler. The command must be unique.
|
||||
* @brief Removed.
|
||||
*
|
||||
* This version of the function uses the OnRootConsoleCommand2 callback.
|
||||
* @param cmd Unused.
|
||||
* @param text Unused.
|
||||
* @param pHandler Unused.
|
||||
* @return False.
|
||||
*/
|
||||
virtual bool AddRootConsoleCommand2(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler) =0;
|
||||
|
||||
/**
|
||||
* @brief Adds a root console command handler. The command must be unique.
|
||||
*
|
||||
* @param cmd String containing the console command.
|
||||
* @param text Description text.
|
||||
* @param pHandler An IRootConsoleCommand pointer to handle the command.
|
||||
* @return True on success, false on too many commands or duplicate command.
|
||||
*/
|
||||
virtual bool AddRootConsoleCommand2(const char *cmd,
|
||||
virtual bool AddRootConsoleCommand3(const char *cmd,
|
||||
const char *text,
|
||||
IRootConsoleCommand *pHandler) =0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user