core/sm_srvcmds.h
author David Anderson <dvander@alliedmods.net>
Wed Jan 17 18:22:00 2007 +0000 (2007-01-17)
changeset 309 51e67f50830e
parent 308 f0e65f92cb34
child 370 d3a484f98f6d
permissions -rw-r--r--
Finished porting the "plugins" command to the new menu system
     1 #ifndef _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
     2 #define _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
     3 
     4 #include "sourcemod.h"
     5 #include <IRootConsoleMenu.h>
     6 #include "PluginSys.h"
     7 #include "sourcemm_api.h"
     8 #include <convar.h>
     9 #include <sh_list.h>
    10 #include <sh_string.h>
    11 #include "sm_trie.h"
    12 
    13 using namespace SourceMod;
    14 using namespace SourceHook;
    15 
    16 struct ConsoleEntry
    17 {
    18 	String command;
    19 	String description;
    20 };
    21 
    22 class RootConsoleMenu : 
    23 	public IConCommandBaseAccessor,
    24 	public SMGlobalClass,
    25 	public IRootConsoleCommand,
    26 	public IRootConsole
    27 {
    28 public:
    29 	RootConsoleMenu();
    30 	~RootConsoleMenu();
    31 public: //IConCommandBaseAccessor
    32 	bool RegisterConCommandBase(ConCommandBase *pCommand);
    33 public: //SMGlobalClass
    34 	void OnSourceModStartup(bool late);
    35 	void OnSourceModShutdown();
    36 public: //IRootConsoleCommand
    37 	void OnRootConsoleCommand(const char *cmd, unsigned int argcount);
    38 public: //IRootConsole
    39 	bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler);
    40 	bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler);
    41 	void ConsolePrint(const char *fmt, ...);
    42 	const char *GetArgument(unsigned int argno);
    43 	unsigned int GetArgumentCount();
    44 	const char *GetArguments();
    45 	void DrawGenericOption(const char *cmd, const char *text);
    46 public:
    47 	void GotRootCmd();
    48 private:
    49 	Trie *m_pCommands;
    50 	List<ConsoleEntry *> m_Menu;
    51 };
    52 
    53 extern RootConsoleMenu g_RootMenu;
    54 
    55 #endif //_INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_