core/ConsoleDetours.h
author Nicholas Hastings <skamonkey@gmail.com>
Sat Jun 02 10:07:25 2012 -0400 (2012-06-02)
changeset 3549 657ea0e26e7a
parent 2841 dde3dd0b4b8b
child 4071 dbb9a3f48650
permissions -rw-r--r--
Added missing CS:GO GameRulesProxy gamedata.
dvander@2807
     1
/**
dvander@2807
     2
 * vim: set ts=4 sw=4 tw=99 noet :
dvander@2807
     3
 * =============================================================================
dvander@2807
     4
 * SourceMod
dvander@2807
     5
 * Copyright (C) 2004-2009 AlliedModders LLC.  All rights reserved.
dvander@2807
     6
 * =============================================================================
dvander@2807
     7
 *
dvander@2807
     8
 * This program is free software; you can redistribute it and/or modify it under
dvander@2807
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
dvander@2807
    10
 * Free Software Foundation.
dvander@2807
    11
 * 
dvander@2807
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@2807
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@2807
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
dvander@2807
    15
 * details.
dvander@2807
    16
 *
dvander@2807
    17
 * You should have received a copy of the GNU General Public License along with
dvander@2807
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@2807
    19
 *
dvander@2807
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
dvander@2807
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@2807
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@2807
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
dvander@2807
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
dvander@2807
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
dvander@2807
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@2807
    27
 * or <http://www.sourcemod.net/license.php>.
dvander@2807
    28
 *
dvander@2807
    29
 * Version: $Id$
dvander@2807
    30
 */
dvander@2807
    31
#ifndef _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_
dvander@2807
    32
#define _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_
dvander@2807
    33
dvander@2807
    34
#include "sm_globals.h"
dvander@2807
    35
#include "sourcemm_api.h"
dvander@2807
    36
#include "ForwardSys.h"
dvander@2807
    37
#include <sm_trie_tpl.h>
dvander@2807
    38
dvander@2841
    39
class ConsoleDetours :
dvander@2841
    40
	public SMGlobalClass,
dvander@2841
    41
	public IFeatureProvider
dvander@2807
    42
{
dvander@2807
    43
	friend class PlayerManager;
dvander@2807
    44
	friend class GenericCommandHooker;
dvander@2807
    45
dvander@2807
    46
	struct Listener
dvander@2807
    47
	{
dvander@2807
    48
		IChangeableForward *forward;
dvander@2807
    49
	};
dvander@2807
    50
public:
dvander@2807
    51
	ConsoleDetours();
dvander@2807
    52
public: //SMGlobalClass
dvander@2807
    53
	void OnSourceModAllInitialized();
dvander@2807
    54
	void OnSourceModShutdown();
dvander@2841
    55
public: //IFeatureProvider
dvander@2841
    56
	FeatureStatus GetFeatureStatus(FeatureType type, const char *name);
dvander@2807
    57
public:
dvander@2807
    58
	bool AddListener(IPluginFunction *fun, const char *command);
dvander@2807
    59
	bool RemoveListener(IPluginFunction *fun, const char *command);
dvander@2807
    60
private:
dvander@2807
    61
	cell_t InternalDispatch(int client, const CCommand& args);
dvander@2807
    62
#if SOURCE_ENGINE >= SE_ORANGEBOX
dvander@2807
    63
	static cell_t Dispatch(ConCommand *pBase, const CCommand& args);
dvander@2807
    64
#else
dvander@2807
    65
	static cell_t Dispatch(ConCommand *pBase);
dvander@2807
    66
#endif
dvander@2807
    67
public:
dvander@2841
    68
	FeatureStatus GetStatus();
dvander@2841
    69
	bool IsEnabled()
dvander@2807
    70
	{
dvander@2841
    71
		return status == FeatureStatus_Available;
dvander@2807
    72
	}
dvander@2807
    73
private:
dvander@2841
    74
	FeatureStatus status;
dvander@2807
    75
	IChangeableForward *m_pForward;
dvander@2807
    76
	KTrie<Listener*> m_CmdLookup;
dvander@2807
    77
	List<Listener*> m_Listeners;
dvander@2807
    78
};
dvander@2807
    79
dvander@2807
    80
extern ConsoleDetours g_ConsoleDetours;
dvander@2807
    81
dvander@2807
    82
#endif /* _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_ */
dvander@2807
    83