sample_mm/engine_wrappers.h
author David Anderson <dvander@alliedmods.net>
Sun Feb 17 23:48:56 2008 +0000 (2008-02-17)
changeset 508 7281e18fdff6
parent 507 ac946e22482b
child 605 131878209276
permissions -rw-r--r--
removed linker warnings in debug mode
     1 /**
     2  * vim: set ts=4 :
     3  * ======================================================
     4  * Metamod:Source Sample Plugin
     5  * Written by AlliedModders LLC.
     6  * ======================================================
     7  *
     8  * This software is provided 'as-is', without any express or implied warranty.
     9  * In no event will the authors be held liable for any damages arising from 
    10  * the use of this software.
    11  *
    12  * This sample plugin is public domain.
    13  *
    14  * Version: $Id$
    15  */
    16 
    17 #ifndef _INCLUDE_SOURCE_ENGINE_WRAPPERS_
    18 #define _INCLUDE_SOURCE_ENGINE_WRAPPERS_
    19 
    20 #include <eiface.h>
    21 
    22 extern IVEngineServer *engine;
    23 
    24 /**
    25  * For non-OrangeBox builds, we have to make wrappers.
    26  */
    27 #if defined ENGINE_ORIGINAL
    28 
    29 /**
    30  * MM:S 1.4.x needs older API calls.
    31  */
    32 #if !defined METAMOD_PLAPI_VERSION
    33 #define GetEngineFactory engineFactory
    34 #define GetServerFactory serverFactory
    35 #define MM_Format snprintf
    36 #else
    37 #error "Metamod:Source 1.6 is not supported on the old engine."
    38 #endif
    39 
    40 /**
    41  * Wrap the CCommand class so our code looks the same for both engines.
    42  */
    43 class CCommand
    44 {
    45 public:
    46 	const char *ArgS()
    47 	{
    48 		return engine->Cmd_Args();
    49 	}
    50 	int ArgC()
    51 	{
    52 		return engine->Cmd_Argc();
    53 	}
    54 
    55 	const char *Arg(int index)
    56 	{
    57 		return engine->Cmd_Argv(index);
    58 	}
    59 };
    60 
    61 #define CVAR_INTERFACE_VERSION				VENGINE_CVAR_INTERFACE_VERSION
    62 #define ENGINE_CALL(func) SH_CALL(m_EngineCC, func)
    63 
    64 #elif defined ENGINE_ORANGEBOX
    65 
    66 #define ENGINE_CALL(func) SH_CALL(engine, func)
    67 #define MM_Format g_SMAPI->Format
    68 
    69 #endif
    70 
    71 #endif //_INCLUDE_SOURCE_ENGINE_WRAPPERS_
    72