stub_plugin/dllapi.cpp
author Scott Ehlert <ds@alliedmods.net>
Thu Sep 26 22:57:05 2013 -0500 (2013-09-26)
changeset 286 202d9c3207a2
parent 0 d15304fcb7a7
permissions -rw-r--r--
Fixed warning when building stub_mm plugin.
     1 // vi: set ts=4 sw=4 :
     2 // vim: set tw=75 :
     3 
     4 /*
     5  * Copyright (c) 2001-2003 Will Day <[email protected]>
     6  *
     7  *    This file is part of Metamod.
     8  *
     9  *    Metamod is free software; you can redistribute it and/or modify it
    10  *    under the terms of the GNU General Public License as published by the
    11  *    Free Software Foundation; either version 2 of the License, or (at
    12  *    your option) any later version.
    13  *
    14  *    Metamod is distributed in the hope that it will be useful, but
    15  *    WITHOUT ANY WARRANTY; without even the implied warranty of
    16  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    17  *    General Public License for more details.
    18  *
    19  *    You should have received a copy of the GNU General Public License
    20  *    along with Metamod; if not, write to the Free Software Foundation,
    21  *    Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    22  *
    23  *    In addition, as a special exception, the author gives permission to
    24  *    link the code of this program with the Half-Life Game Engine ("HL
    25  *    Engine") and Modified Game Libraries ("MODs") developed by Valve,
    26  *    L.L.C ("Valve").  You must obey the GNU General Public License in all
    27  *    respects for all of the code used other than the HL Engine and MODs
    28  *    from Valve.  If you modify this file, you may extend this exception
    29  *    to your version of the file, but you are not obligated to do so.  If
    30  *    you do not wish to do so, delete this exception statement from your
    31  *    version.
    32  *
    33  */
    34 
    35 #include <extdll.h>
    36 
    37 #include <dllapi.h>
    38 #include <meta_api.h>
    39 
    40 static DLL_FUNCTIONS gFunctionTable = 
    41 {
    42 	NULL,					// pfnGameInit
    43 	NULL,					// pfnSpawn
    44 	NULL,					// pfnThink
    45 	NULL,					// pfnUse
    46 	NULL,					// pfnTouch
    47 	NULL,					// pfnBlocked
    48 	NULL,					// pfnKeyValue
    49 	NULL,					// pfnSave
    50 	NULL,					// pfnRestore
    51 	NULL,					// pfnSetAbsBox
    52 
    53 	NULL,					// pfnSaveWriteFields
    54 	NULL,					// pfnSaveReadFields
    55 
    56 	NULL,					// pfnSaveGlobalState
    57 	NULL,					// pfnRestoreGlobalState
    58 	NULL,					// pfnResetGlobalState
    59 
    60 	NULL,					// pfnClientConnect
    61 	NULL,					// pfnClientDisconnect
    62 	NULL,					// pfnClientKill
    63 	NULL,					// pfnClientPutInServer
    64 	NULL,					// pfnClientCommand
    65 	NULL,					// pfnClientUserInfoChanged
    66 	NULL,					// pfnServerActivate
    67 	NULL,					// pfnServerDeactivate
    68 
    69 	NULL,					// pfnPlayerPreThink
    70 	NULL,					// pfnPlayerPostThink
    71 
    72 	NULL,					// pfnStartFrame
    73 	NULL,					// pfnParmsNewLevel
    74 	NULL,					// pfnParmsChangeLevel
    75 
    76 	NULL,					// pfnGetGameDescription
    77 	NULL,					// pfnPlayerCustomization
    78 
    79 	NULL,					// pfnSpectatorConnect
    80 	NULL,					// pfnSpectatorDisconnect
    81 	NULL,					// pfnSpectatorThink
    82 	
    83 	NULL,					// pfnSys_Error
    84 
    85 	NULL,					// pfnPM_Move
    86 	NULL,					// pfnPM_Init
    87 	NULL,					// pfnPM_FindTextureType
    88 	
    89 	NULL,					// pfnSetupVisibility
    90 	NULL,					// pfnUpdateClientData
    91 	NULL,					// pfnAddToFullPack
    92 	NULL,					// pfnCreateBaseline
    93 	NULL,					// pfnRegisterEncoders
    94 	NULL,					// pfnGetWeaponData
    95 	NULL,					// pfnCmdStart
    96 	NULL,					// pfnCmdEnd
    97 	NULL,					// pfnConnectionlessPacket
    98 	NULL,					// pfnGetHullBounds
    99 	NULL,					// pfnCreateInstancedBaselines
   100 	NULL,					// pfnInconsistentFile
   101 	NULL,					// pfnAllowLagCompensation
   102 };
   103 
   104 C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, 
   105 		int *interfaceVersion)
   106 {
   107 	if(!pFunctionTable) {
   108 		UTIL_LogPrintf("GetEntityAPI2 called with null pFunctionTable");
   109 		return(FALSE);
   110 	}
   111 	else if(*interfaceVersion != INTERFACE_VERSION) {
   112 		UTIL_LogPrintf("GetEntityAPI2 version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION);
   113 		//! Tell metamod what version we had, so it can figure out who is out of date.
   114 		*interfaceVersion = INTERFACE_VERSION;
   115 		return(FALSE);
   116 	}
   117 	memcpy(pFunctionTable, &gFunctionTable, sizeof(DLL_FUNCTIONS));
   118 	return(TRUE);
   119 }