core/sm_srvcmds.h
author Fyren <fyrenmoo@gmail.com>
Wed Apr 01 05:56:51 2009 -0700 (2009-04-01)
changeset 2692 126e2d41c2b3
parent 2289 44045ead61cd
child 2728 96022dad7e53
permissions -rw-r--r--
Disable nextmap in Synergy and Dystopia (bug 3687, bug 3741; r=liam)
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod
     5  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
     6  * =============================================================================
     7  *
     8  * This program is free software; you can redistribute it and/or modify it under
     9  * the terms of the GNU General Public License, version 3.0, as published by the
    10  * Free Software Foundation.
    11  * 
    12  * This program is distributed in the hope that it will be useful, but WITHOUT
    13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    14  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    15  * details.
    16  *
    17  * You should have received a copy of the GNU General Public License along with
    18  * this program.  If not, see <http://www.gnu.org/licenses/>.
    19  *
    20  * As a special exception, AlliedModders LLC gives you permission to link the
    21  * code of this program (as well as its derivative works) to "Half-Life 2," the
    22  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    23  * by the Valve Corporation.  You must obey the GNU General Public License in
    24  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    25  * this exception to all derivative works.  AlliedModders LLC defines further
    26  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    27  * or <http://www.sourcemod.net/license.php>.
    28  *
    29  * Version: $Id$
    30  */
    31 
    32 #ifndef _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
    33 #define _INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_
    34 
    35 #include "sourcemod.h"
    36 #include <IRootConsoleMenu.h>
    37 #include "PluginSys.h"
    38 #include "sourcemm_api.h"
    39 #include <sh_list.h>
    40 #include <sh_string.h>
    41 #include <compat_wrappers.h>
    42 #include "sm_trie.h"
    43 
    44 using namespace SourceMod;
    45 using namespace SourceHook;
    46 
    47 struct ConsoleEntry
    48 {
    49 	String command;
    50 	String description;
    51 };
    52 
    53 class RootConsoleMenu : 
    54 	public IConCommandBaseAccessor,
    55 	public SMGlobalClass,
    56 	public IRootConsoleCommand,
    57 	public IRootConsole
    58 {
    59 public:
    60 	RootConsoleMenu();
    61 	~RootConsoleMenu();
    62 public:
    63 	const char *GetInterfaceName();
    64 	unsigned int GetInterfaceVersion();
    65 public: //IConCommandBaseAccessor
    66 	bool RegisterConCommandBase(ConCommandBase *pCommand);
    67 public: //SMGlobalClass
    68 	void OnSourceModStartup(bool late);
    69 	void OnSourceModAllInitialized();
    70 	void OnSourceModShutdown();
    71 public: //IRootConsoleCommand
    72 	void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
    73 public: //IRootConsole
    74 	bool AddRootConsoleCommand(const char *cmd, const char *text, IRootConsoleCommand *pHandler);
    75 	bool RemoveRootConsoleCommand(const char *cmd, IRootConsoleCommand *pHandler);
    76 	void ConsolePrint(const char *fmt, ...);
    77 	void DrawGenericOption(const char *cmd, const char *text);
    78 public:
    79 	void GotRootCmd(const CCommand &cmd);
    80 private:
    81 	bool m_CfgExecDone;
    82 	Trie *m_pCommands;
    83 	List<ConsoleEntry *> m_Menu;
    84 };
    85 
    86 extern RootConsoleMenu g_RootMenu;
    87 
    88 #endif //_INCLUDE_SOURCEMOD_SERVERCOMMANDS_H_