public/mms_sample_ext/sm_sdk_config.cpp

00001 /**
00002  * vim: set ts=4 :
00003  * =============================================================================
00004  * SourceMod Extension Code for Metamod:Source
00005  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
00006  * =============================================================================
00007  *
00008  * This program is free software; you can redistribute it and/or modify it under
00009  * the terms of the GNU General Public License, version 3.0, as published by the
00010  * Free Software Foundation.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00015  * details.
00016  *
00017  * You should have received a copy of the GNU General Public License along with
00018  * this program.  If not, see <http://www.gnu.org/licenses/>.
00019  *
00020  * As a special exception, AlliedModders LLC gives you permission to link the
00021  * code of this program (as well as its derivative works) to "Half-Life 2," the
00022  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
00023  * by the Valve Corporation.  You must obey the GNU General Public License in
00024  * all respects for all other code used.  Additionally, AlliedModders LLC grants
00025  * this exception to all derivative works.  AlliedModders LLC defines further
00026  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
00027  * or <http://www.sourcemod.net/license.php>.
00028  *
00029  * Version: $Id$
00030  */
00031 
00032 #include "sm_sdk_config.h"
00033 
00034 using namespace SourceMod;
00035 
00036 bool SM_AcquireInterfaces(char *error, size_t maxlength)
00037 {
00038           SM_FIND_IFACE_OR_FAIL(SOURCEMOD, sm_main, error, maxlength);
00039 
00040 #if defined SMEXT_ENABLE_FORWARDSYS
00041           SM_FIND_IFACE_OR_FAIL(FORWARDMANAGER, sm_forwards, error, maxlength);
00042 #endif
00043 #if defined SMEXT_ENABLE_HANDLESYS
00044           SM_FIND_IFACE_OR_FAIL(HANDLESYSTEM, sm_handlesys, error, maxlength);
00045 #endif
00046 #if defined SMEXT_ENABLE_PLAYERHELPERS
00047           SM_FIND_IFACE_OR_FAIL(PLAYERMANAGER, sm_players, error, maxlength);
00048 #endif
00049 #if defined SMEXT_ENABLE_DBMANAGER
00050           SM_FIND_IFACE_OR_FAIL(DBI, sm_dbi, error, maxlength);
00051 #endif 
00052 #if defined SMEXT_ENABLE_GAMECONF
00053           SM_FIND_IFACE_OR_FAIL(GAMECONFIG, sm_gameconfs, error, maxlength);
00054 #endif
00055 #if defined SMEXT_ENABLE_MEMUTILS
00056           SM_FIND_IFACE_OR_FAIL(MEMORYUTILS, sm_memutils, error, maxlength);
00057 #endif
00058 #if defined SMEXT_ENABLE_GAMEHELPERS
00059           SM_FIND_IFACE_OR_FAIL(GAMEHELPERS, sm_gamehelpers, error, maxlength);
00060 #endif
00061 #if defined SMEXT_ENABLE_TIMERSYS
00062           SM_FIND_IFACE_OR_FAIL(TIMERSYS, sm_timersys, error, maxlength);
00063 #endif
00064 #if defined SMEXT_ENABLE_THREADER
00065           SM_FIND_IFACE_OR_FAIL(THREADER, sm_threader, error, maxlength);
00066 #endif
00067 #if defined SMEXT_ENABLE_LIBSYS
00068           SM_FIND_IFACE_OR_FAIL(LIBRARYSYS, sm_libsys, error, maxlength);
00069 #endif
00070 #if defined SMEXT_ENABLE_PLUGINSYS
00071           SM_FIND_IFACE_OR_FAIL(PLUGINSYSTEM, sm_plsys, error, maxlength);
00072 #endif 
00073 #if defined SMEXT_ENABLE_MENUS
00074           SM_FIND_IFACE_OR_FAIL(MENUMANAGER, sm_menus, error, maxlength);
00075 #endif
00076 #if defined SMEXT_ENABLE_ADMINSYS
00077           SM_FIND_IFACE_OR_FAIL(ADMINSYS, sm_adminsys, error, maxlength);
00078 #endif
00079 #if defined SMEXT_ENABLE_TEXTPARSERS
00080           SM_FIND_IFACE_OR_FAIL(TEXTPARSERS, sm_text, error, maxlength);
00081 #endif
00082 #if defined SMEXT_ENABLE_TRANSLATOR
00083           SM_FIND_IFACE_OR_FAIL(TRANSLATOR, sm_translator, error, maxlength);
00084 #endif
00085 
00086           return true;
00087 }
00088 
00089 void SM_UnsetInterfaces()
00090 {
00091           myself = NULL;
00092           smexts = NULL;
00093           sharesys = NULL;
00094           sm_main = NULL;
00095 #if defined SMEXT_ENABLE_FORWARDSYS
00096           sm_forwards = NULL;
00097 #endif
00098 #if defined SMEXT_ENABLE_HANDLESYS
00099           sm_handlesys = NULL;
00100 #endif
00101 #if defined SMEXT_ENABLE_PLAYERHELPERS
00102           sm_players = NULL;
00103 #endif
00104 #if defined SMEXT_ENABLE_DBMANAGER
00105           sm_dbi = NULL;
00106 #endif 
00107 #if defined SMEXT_ENABLE_GAMECONF
00108           sm_gameconfs = NULL;
00109 #endif
00110 #if defined SMEXT_ENABLE_MEMUTILS
00111           sm_memutils = NULL;
00112 #endif
00113 #if defined SMEXT_ENABLE_GAMEHELPERS
00114           sm_gamehelpers = NULL;
00115 #endif
00116 #if defined SMEXT_ENABLE_TIMERSYS
00117           sm_timersys = NULL;
00118 #endif
00119 #if defined SMEXT_ENABLE_THREADER
00120           sm_threader = NULL;
00121 #endif
00122 #if defined SMEXT_ENABLE_LIBSYS
00123           sm_libsys = NULL;
00124 #endif
00125 #if defined SMEXT_ENABLE_PLUGINSYS
00126           sm_plsys = NULL;
00127 #endif 
00128 #if defined SMEXT_ENABLE_MENUS
00129           sm_menus = NULL;
00130 #endif
00131 #if defined SMEXT_ENABLE_ADMINSYS
00132           sm_adminsys = NULL;
00133 #endif
00134 #if defined SMEXT_ENABLE_TEXTPARSERS
00135           sm_text = NULL;
00136 #endif
00137 #if defined SMEXT_ENABLE_TRANSLATOR
00138           sm_translator = NULL;
00139 #endif
00140 }
00141 
00142 IExtension *myself = NULL;
00143 IExtensionManager *smexts = NULL;
00144 IShareSys *sharesys = NULL;
00145 SourceMod::ISourceMod *sm_main = NULL;
00146 #if defined SMEXT_ENABLE_FORWARDSYS
00147 SourceMod::IForwardManager *sm_forwards = NULL;
00148 #endif
00149 #if defined SMEXT_ENABLE_HANDLESYS
00150 SourceMod::IHandleSys *sm_handlesys = NULL;
00151 #endif
00152 #if defined SMEXT_ENABLE_PLAYERHELPERS
00153 SourceMod::IPlayerManager *sm_players = NULL;
00154 #endif
00155 #if defined SMEXT_ENABLE_DBMANAGER
00156 SourceMod::IDBManager *sm_dbi = NULL;
00157 #endif 
00158 #if defined SMEXT_ENABLE_GAMECONF
00159 SourceMod::IGameConfigManager *sm_gameconfs = NULL;
00160 #endif
00161 #if defined SMEXT_ENABLE_MEMUTILS
00162 SourceMod::IMemoryUtils *sm_memutils = NULL;
00163 #endif
00164 #if defined SMEXT_ENABLE_GAMEHELPERS
00165 SourceMod::IGameHelpers *sm_gamehelpers = NULL;
00166 #endif
00167 #if defined SMEXT_ENABLE_TIMERSYS
00168 SourceMod::ITimerSystem *sm_timersys = NULL;
00169 #endif
00170 #if defined SMEXT_ENABLE_THREADER
00171 SourceMod::IThreader *sm_threader = NULL;
00172 #endif
00173 #if defined SMEXT_ENABLE_LIBSYS
00174 SourceMod::ILibrarySys *sm_libsys = NULL;
00175 #endif
00176 #if defined SMEXT_ENABLE_PLUGINSYS
00177 SourceMod::IPluginManager *sm_plsys = NULL;
00178 #endif 
00179 #if defined SMEXT_ENABLE_MENUS
00180 SourceMod::IMenuManager *sm_menus = NULL;
00181 #endif
00182 #if defined SMEXT_ENABLE_ADMINSYS
00183 SourceMod::IAdminSystem *sm_adminsys = NULL;
00184 #endif
00185 #if defined SMEXT_ENABLE_TEXTPARSERS
00186 SourceMod::ITextParsers *sm_text = NULL;
00187 #endif
00188 #if defined SMEXT_ENABLE_TRANSLATOR
00189 SourceMod::ITranslator *sm_translator = NULL;
00190 #endif

Generated on Sun Dec 28 23:26:25 2008 for SourceMod SDK by  doxygen 1.5.1