core/sourcemm_api.cpp
author David Anderson <dvander@alliedmods.net>
Thu Feb 08 01:11:45 2007 +0000 (2007-02-08)
changeset 453 7611078f11cd
parent 448 25984ddd0ce0
child 457 9b8a85bf4175
permissions -rw-r--r--
added gameevents to the publicly available interfaces
     1 /**
     2  * ===============================================================
     3  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     4  * ===============================================================
     5  *
     6  * This file is not open source and may not be copied without explicit
     7  * written permission of AlliedModders LLC.  This file may not be redistributed 
     8  * in whole or significant part.
     9  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    10  *
    11  * Version: $Id$
    12  */
    13 
    14 #include <oslink.h>
    15 #include "sourcemm_api.h"
    16 #include "sm_version.h"
    17 #include "sourcemod.h"
    18 
    19 SourceMod_Core g_SourceMod_Core;
    20 IVEngineServer *engine = NULL;
    21 IServerGameDLL *gamedll = NULL;
    22 IServerGameClients *serverClients = NULL;
    23 ISmmPluginManager *g_pMMPlugins = NULL;
    24 CGlobalVars *gpGlobals = NULL;
    25 IGameEventManager2 *gameevents = NULL;
    26 
    27 PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
    28 
    29 bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
    30 {
    31 	PLUGIN_SAVEVARS();
    32 
    33 	GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
    34 	GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
    35 	GET_V_IFACE_CURRENT(serverFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
    36 	GET_V_IFACE_CURRENT(engineFactory, gameevents, IGameEventManager2, INTERFACEVERSION_GAMEEVENTSMANAGER2);
    37 
    38 	if ((g_pMMPlugins = (ISmmPluginManager *)g_SMAPI->MetaFactory(MMIFACE_PLMANAGER, NULL, NULL)) == NULL)
    39 	{
    40 		if (error)
    41 		{
    42 			snprintf(error, maxlen, "Unable to find interface %s", MMIFACE_PLMANAGER);
    43 		}
    44 		return false;
    45 	}
    46 
    47 	gpGlobals = ismm->pGlobals();
    48 
    49 	return g_SourceMod.InitializeSourceMod(error, maxlen, late);
    50 }
    51 
    52 bool SourceMod_Core::Unload(char *error, size_t maxlen)
    53 {
    54 	g_SourceMod.CloseSourceMod();
    55 	return true;
    56 }
    57 
    58 bool SourceMod_Core::Pause(char *error, size_t maxlen)
    59 {
    60 	return true;
    61 }
    62 
    63 bool SourceMod_Core::Unpause(char *error, size_t maxlen)
    64 {
    65 	return true;
    66 }
    67 
    68 void SourceMod_Core::AllPluginsLoaded()
    69 {
    70 }
    71 
    72 const char *SourceMod_Core::GetAuthor()
    73 {
    74 	return "AlliedModders, LLC";
    75 }
    76 
    77 const char *SourceMod_Core::GetName()
    78 {
    79 	return "SourceMod";
    80 }
    81 
    82 const char *SourceMod_Core::GetDescription()
    83 {
    84 	return "Extensible administration and scripting system";
    85 }
    86 
    87 const char *SourceMod_Core::GetURL()
    88 {
    89 	return "http://www.sourcemod.net/";
    90 }
    91 
    92 const char *SourceMod_Core::GetLicense()
    93 {
    94 	return "See LICENSE.txt";
    95 }
    96 
    97 const char *SourceMod_Core::GetVersion()
    98 {
    99 	return SOURCEMOD_VERSION;
   100 }
   101 
   102 const char *SourceMod_Core::GetDate()
   103 {
   104 	return __DATE__;
   105 }
   106 
   107 const char *SourceMod_Core::GetLogTag()
   108 {
   109 	return "SRCMOD";
   110 }