1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-01 13:24:25 +01:00
HLMetaModOfficial/sample_mm/engine_wrappers.h
David Anderson c4eeaaf2d1 builds on OB again
--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40649
2008-02-17 23:40:37 +00:00

73 lines
1.5 KiB
C++

/**
* vim: set ts=4 :
* ======================================================
* Metamod:Source Sample Plugin
* Written by AlliedModders LLC.
* ======================================================
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* This sample plugin is public domain.
*
* Version: $Id$
*/
#ifndef _INCLUDE_SOURCE_ENGINE_WRAPPERS_
#define _INCLUDE_SOURCE_ENGINE_WRAPPERS_
#include <eiface.h>
extern IVEngineServer *engine;
/**
* For non-OrangeBox builds, we have to make wrappers.
*/
#if defined ENGINE_ORIGINAL
/**
* MM:S 1.4.x needs older API calls.
*/
#if !defined METAMOD_PLAPI_VERSION
#define GetEngineFactory engineFactory
#define GetServerFactory serverFactory
#define MM_Format snprintf
#else
#error "Metamod:Source 1.6 is not supported on the old engine."
#endif
/**
* Wrap the CCommand class so our code looks the same for both engines.
*/
class CCommand
{
public:
const char *ArgS()
{
return engine->Cmd_Args();
}
int ArgC()
{
return engine->Cmd_Argc();
}
const char *Arg(int index)
{
return engine->Cmd_Argv(index);
}
};
#define CVAR_INTERFACE_VERSION VENGINE_CVAR_INTERFACE_VERSION
#define ENGINE_CALL(func) SH_CALL(m_EngineCC, func)
#elif defined ENGINE_ORANGEBOX
#define ENGINE_CALL(func) SH_CALL(engine, func)
#define MM_Format g_SMAPI->Format
#endif
#endif //_INCLUDE_SOURCE_ENGINE_WRAPPERS_