core/sourcemm_api.cpp
author Borja Ferrer <faluco@alliedmods.net>
Sat Jan 20 02:12:53 2007 +0000 (2007-01-20)
changeset 333 b668cbd49c35
parent 304 fa485d2f25ed
child 370 d3a484f98f6d
permissions -rw-r--r--
plugins get updated on map change
maponly plugins get unloaded on map change
     1 #include <oslink.h>
     2 #include "sourcemm_api.h"
     3 #include "sm_version.h"
     4 #include "sourcemod.h"
     5 
     6 SourceMod_Core g_SourceMod_Core;
     7 IVEngineServer *engine = NULL;
     8 IServerGameDLL *gamedll = NULL;
     9 IServerGameClients *serverClients = NULL;
    10 ISmmPluginManager *g_pMMPlugins = NULL;
    11 
    12 PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
    13 
    14 bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
    15 {
    16 	PLUGIN_SAVEVARS();
    17 
    18 	GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
    19 	GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
    20 	GET_V_IFACE_CURRENT(serverFactory, serverClients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
    21 
    22 	if ((g_pMMPlugins = (ISmmPluginManager *)g_SMAPI->MetaFactory(MMIFACE_PLMANAGER, NULL, NULL)) == NULL)
    23 	{
    24 		if (error)
    25 		{
    26 			snprintf(error, maxlen, "Unable to find interface %s", MMIFACE_PLMANAGER);
    27 		}
    28 		return false;
    29 	}
    30 
    31 	return g_SourceMod.InitializeSourceMod(error, maxlen, late);
    32 }
    33 
    34 bool SourceMod_Core::Unload(char *error, size_t maxlen)
    35 {
    36 	g_SourceMod.CloseSourceMod();
    37 	return true;
    38 }
    39 
    40 bool SourceMod_Core::Pause(char *error, size_t maxlen)
    41 {
    42 	return true;
    43 }
    44 
    45 bool SourceMod_Core::Unpause(char *error, size_t maxlen)
    46 {
    47 	return true;
    48 }
    49 
    50 void SourceMod_Core::AllPluginsLoaded()
    51 {
    52 }
    53 
    54 const char *SourceMod_Core::GetAuthor()
    55 {
    56 	return "AlliedModders, LLC";
    57 }
    58 
    59 const char *SourceMod_Core::GetName()
    60 {
    61 	return "SourceMod";
    62 }
    63 
    64 const char *SourceMod_Core::GetDescription()
    65 {
    66 	return "Extensible administration and scripting system";
    67 }
    68 
    69 const char *SourceMod_Core::GetURL()
    70 {
    71 	return "http://www.sourcemod.net/";
    72 }
    73 
    74 const char *SourceMod_Core::GetLicense()
    75 {
    76 	return "See LICENSE.txt";
    77 }
    78 
    79 const char *SourceMod_Core::GetVersion()
    80 {
    81 	return SOURCEMOD_VERSION;
    82 }
    83 
    84 const char *SourceMod_Core::GetDate()
    85 {
    86 	return __DATE__;
    87 }
    88 
    89 const char *SourceMod_Core::GetLogTag()
    90 {
    91 	return "SRCMOD";
    92 }