dvander@2807: /**
dvander@2807: * vim: set ts=4 sw=4 tw=99 noet :
dvander@2807: * =============================================================================
dvander@2807: * SourceMod
dvander@2807: * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
dvander@2807: * =============================================================================
dvander@2807: *
dvander@2807: * This program is free software; you can redistribute it and/or modify it under
dvander@2807: * the terms of the GNU General Public License, version 3.0, as published by the
dvander@2807: * Free Software Foundation.
dvander@2807: *
dvander@2807: * This program is distributed in the hope that it will be useful, but WITHOUT
dvander@2807: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
dvander@2807: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
dvander@2807: * details.
dvander@2807: *
dvander@2807: * You should have received a copy of the GNU General Public License along with
dvander@2807: * this program. If not, see .
dvander@2807: *
dvander@2807: * As a special exception, AlliedModders LLC gives you permission to link the
dvander@2807: * code of this program (as well as its derivative works) to "Half-Life 2," the
dvander@2807: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
dvander@2807: * by the Valve Corporation. You must obey the GNU General Public License in
dvander@2807: * all respects for all other code used. Additionally, AlliedModders LLC grants
dvander@2807: * this exception to all derivative works. AlliedModders LLC defines further
dvander@2807: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
dvander@2807: * or .
dvander@2807: *
dvander@2807: * Version: $Id$
dvander@2807: */
dvander@2807: #ifndef _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_
dvander@2807: #define _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_
dvander@2807:
dvander@2807: #include "sm_globals.h"
dvander@2807: #include "sourcemm_api.h"
dvander@2807: #include "ForwardSys.h"
dvander@2807: #include
dvander@2807:
dvander@2841: class ConsoleDetours :
dvander@2841: public SMGlobalClass,
dvander@2841: public IFeatureProvider
dvander@2807: {
dvander@2807: friend class PlayerManager;
dvander@2807: friend class GenericCommandHooker;
dvander@2807:
dvander@2807: struct Listener
dvander@2807: {
dvander@2807: IChangeableForward *forward;
dvander@2807: };
dvander@2807: public:
dvander@2807: ConsoleDetours();
dvander@2807: public: //SMGlobalClass
dvander@2807: void OnSourceModAllInitialized();
dvander@2807: void OnSourceModShutdown();
dvander@2841: public: //IFeatureProvider
dvander@2841: FeatureStatus GetFeatureStatus(FeatureType type, const char *name);
dvander@2807: public:
dvander@2807: bool AddListener(IPluginFunction *fun, const char *command);
dvander@2807: bool RemoveListener(IPluginFunction *fun, const char *command);
dvander@2807: private:
dvander@2807: cell_t InternalDispatch(int client, const CCommand& args);
dvander@2807: #if SOURCE_ENGINE >= SE_ORANGEBOX
dvander@2807: static cell_t Dispatch(ConCommand *pBase, const CCommand& args);
dvander@2807: #else
dvander@2807: static cell_t Dispatch(ConCommand *pBase);
dvander@2807: #endif
dvander@2807: public:
dvander@2841: FeatureStatus GetStatus();
dvander@2841: bool IsEnabled()
dvander@2807: {
dvander@2841: return status == FeatureStatus_Available;
dvander@2807: }
dvander@2807: private:
dvander@2841: FeatureStatus status;
dvander@2807: IChangeableForward *m_pForward;
dvander@2807: KTrie m_CmdLookup;
dvander@2807: List m_Listeners;
dvander@2807: };
dvander@2807:
dvander@2807: extern ConsoleDetours g_ConsoleDetours;
dvander@2807:
dvander@2807: #endif /* _INCLUDE_SOURCEMOD_CONSOLE_DETOURS_H_ */
dvander@2807: