core/provider/console.h
author Scott Ehlert <ds@alliedmods.net>
Thu Dec 10 00:59:50 2009 -0600 (2009-12-10)
changeset 689 4065ba5e9155
parent 637 b66489d8aedc
child 725 9eec529c3caa
permissions -rw-r--r--
Rewrote user message caching code to always use IServerGameDLL::GetUserMessageInfo (bug 4117, r=dvander).

Games where the above function can crash are handled by detouring tier0's Error() function and jumping back to our own code. So in theory this should work on all games now.
dvander@368
     1
/**
dvander@368
     2
 * vim: set ts=4 :
dvander@368
     3
 * ======================================================
dvander@368
     4
 * Metamod:Source
ds@523
     5
 * Copyright (C) 2004-2008 AlliedModders LLC and authors.
dvander@368
     6
 * All rights reserved.
dvander@368
     7
 * ======================================================
dvander@368
     8
 *
dvander@368
     9
 * This software is provided 'as-is', without any express or implied warranty.
dvander@368
    10
 * In no event will the authors be held liable for any damages arising from 
dvander@368
    11
 * the use of this software.
dvander@368
    12
 * 
dvander@368
    13
 * Permission is granted to anyone to use this software for any purpose, 
dvander@368
    14
 * including commercial applications, and to alter it and redistribute it 
dvander@368
    15
 * freely, subject to the following restrictions:
dvander@368
    16
 *
dvander@368
    17
 * 1. The origin of this software must not be misrepresented; you must not 
dvander@368
    18
 * claim that you wrote the original software. If you use this software in a 
dvander@368
    19
 * product, an acknowledgment in the product documentation would be 
dvander@368
    20
 * appreciated but is not required.
dvander@368
    21
 * 2. Altered source versions must be plainly marked as such, and must not be
dvander@368
    22
 * misrepresented as being the original software.
dvander@368
    23
 * 3. This notice may not be removed or altered from any source distribution.
dvander@368
    24
 *
dvander@368
    25
 * Version: $Id$
dvander@368
    26
 */
dvander@368
    27
dvander@368
    28
#ifndef _INCLUDE_CONSOLE_MMS_H_
dvander@368
    29
#define _INCLUDE_CONSOLE_MMS_H_
dvander@368
    30
dvander@368
    31
#if defined _DEBUG
dvander@368
    32
#define DEBUG2
dvander@368
    33
#undef _DEBUG
dvander@368
    34
#endif
dvander@368
    35
#include <interface.h>
ds@637
    36
#include "convar.h"
dvander@368
    37
#include <eiface.h>
dvander@368
    38
#include <sh_list.h>
dvander@368
    39
#if defined DEBUG2
dvander@368
    40
#undef DEBUG2
dvander@368
    41
#define _DEBUG
dvander@368
    42
#endif
dvander@368
    43
dvander@368
    44
class SMConVarAccessor : public IConCommandBaseAccessor
dvander@368
    45
{
dvander@368
    46
public:
dvander@368
    47
	bool RegisterConCommandBase(ConCommandBase *pCommand);
dvander@368
    48
	bool Register(ConCommandBase *pCommand);
dvander@368
    49
	void Unregister(ConCommandBase *pCommand);
ds@637
    50
	void RemoveMetamodCommands();
ds@637
    51
#if SOURCE_ENGINE == SE_DARKMESSIAH
ds@637
    52
	bool InitConCommandBaseList();
ds@637
    53
private:
ds@637
    54
	ConCommandBase **m_TopConCommandBase;
ds@637
    55
#endif
ds@637
    56
private:
ds@637
    57
	SourceHook::List<ConCommandBase *> m_RegisteredCommands;
dvander@368
    58
};
dvander@368
    59
dvander@368
    60
extern SMConVarAccessor g_SMConVarAccessor;
dvander@368
    61
dvander@368
    62
#endif //_INCLUDE_CONSOLE_MMS_H_
dvander@368
    63