smsdk_config.cpp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /**
  2. * vim: set ts=4 :
  3. * =============================================================================
  4. * SourceMod Extension Code for Metamod:Source
  5. * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
  6. * =============================================================================
  7. *
  8. * This program is free software; you can redistribute it and/or modify it under
  9. * the terms of the GNU General Public License, version 3.0, as published by the
  10. * Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  14. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  15. * details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. * As a special exception, AlliedModders LLC gives you permission to link the
  21. * code of this program (as well as its derivative works) to "Half-Life 2," the
  22. * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
  23. * by the Valve Corporation. You must obey the GNU General Public License in
  24. * all respects for all other code used. Additionally, AlliedModders LLC grants
  25. * this exception to all derivative works. AlliedModders LLC defines further
  26. * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
  27. * or <http://www.sourcemod.net/license.php>.
  28. *
  29. * Version: $Id$
  30. */
  31. #include "smsdk_config.h"
  32. using namespace SourceMod;
  33. bool SM_AcquireInterfaces(char *error, size_t maxlength)
  34. {
  35. SM_FIND_IFACE_OR_FAIL(SOURCEMOD, sm_main, error, maxlength);
  36. #if defined SMEXT_ENABLE_FORWARDSYS
  37. SM_FIND_IFACE_OR_FAIL(FORWARDMANAGER, sm_forwards, error, maxlength);
  38. #endif
  39. #if defined SMEXT_ENABLE_HANDLESYS
  40. SM_FIND_IFACE_OR_FAIL(HANDLESYSTEM, sm_handlesys, error, maxlength);
  41. #endif
  42. #if defined SMEXT_ENABLE_PLAYERHELPERS
  43. SM_FIND_IFACE_OR_FAIL(PLAYERMANAGER, sm_players, error, maxlength);
  44. #endif
  45. #if defined SMEXT_ENABLE_DBMANAGER
  46. SM_FIND_IFACE_OR_FAIL(DBI, sm_dbi, error, maxlength);
  47. #endif
  48. #if defined SMEXT_ENABLE_GAMECONF
  49. SM_FIND_IFACE_OR_FAIL(GAMECONFIG, sm_gameconfs, error, maxlength);
  50. #endif
  51. #if defined SMEXT_ENABLE_MEMUTILS
  52. SM_FIND_IFACE_OR_FAIL(MEMORYUTILS, sm_memutils, error, maxlength);
  53. #endif
  54. #if defined SMEXT_ENABLE_GAMEHELPERS
  55. SM_FIND_IFACE_OR_FAIL(GAMEHELPERS, sm_gamehelpers, error, maxlength);
  56. #endif
  57. #if defined SMEXT_ENABLE_TIMERSYS
  58. SM_FIND_IFACE_OR_FAIL(TIMERSYS, sm_timersys, error, maxlength);
  59. #endif
  60. #if defined SMEXT_ENABLE_THREADER
  61. SM_FIND_IFACE_OR_FAIL(THREADER, sm_threader, error, maxlength);
  62. #endif
  63. #if defined SMEXT_ENABLE_LIBSYS
  64. SM_FIND_IFACE_OR_FAIL(LIBRARYSYS, sm_libsys, error, maxlength);
  65. #endif
  66. #if defined SMEXT_ENABLE_PLUGINSYS
  67. SM_FIND_IFACE_OR_FAIL(PLUGINSYSTEM, sm_plsys, error, maxlength);
  68. #endif
  69. #if defined SMEXT_ENABLE_MENUS
  70. SM_FIND_IFACE_OR_FAIL(MENUMANAGER, sm_menus, error, maxlength);
  71. #endif
  72. #if defined SMEXT_ENABLE_ADMINSYS
  73. SM_FIND_IFACE_OR_FAIL(ADMINSYS, sm_adminsys, error, maxlength);
  74. #endif
  75. #if defined SMEXT_ENABLE_TEXTPARSERS
  76. SM_FIND_IFACE_OR_FAIL(TEXTPARSERS, sm_text, error, maxlength);
  77. #endif
  78. #if defined SMEXT_ENABLE_TRANSLATOR
  79. SM_FIND_IFACE_OR_FAIL(TRANSLATOR, sm_translator, error, maxlength);
  80. #endif
  81. return true;
  82. }
  83. void SM_UnsetInterfaces()
  84. {
  85. myself = NULL;
  86. smexts = NULL;
  87. sharesys = NULL;
  88. sm_main = NULL;
  89. #if defined SMEXT_ENABLE_FORWARDSYS
  90. sm_forwards = NULL;
  91. #endif
  92. #if defined SMEXT_ENABLE_HANDLESYS
  93. sm_handlesys = NULL;
  94. #endif
  95. #if defined SMEXT_ENABLE_PLAYERHELPERS
  96. sm_players = NULL;
  97. #endif
  98. #if defined SMEXT_ENABLE_DBMANAGER
  99. sm_dbi = NULL;
  100. #endif
  101. #if defined SMEXT_ENABLE_GAMECONF
  102. sm_gameconfs = NULL;
  103. #endif
  104. #if defined SMEXT_ENABLE_MEMUTILS
  105. sm_memutils = NULL;
  106. #endif
  107. #if defined SMEXT_ENABLE_GAMEHELPERS
  108. sm_gamehelpers = NULL;
  109. #endif
  110. #if defined SMEXT_ENABLE_TIMERSYS
  111. sm_timersys = NULL;
  112. #endif
  113. #if defined SMEXT_ENABLE_THREADER
  114. sm_threader = NULL;
  115. #endif
  116. #if defined SMEXT_ENABLE_LIBSYS
  117. sm_libsys = NULL;
  118. #endif
  119. #if defined SMEXT_ENABLE_PLUGINSYS
  120. sm_plsys = NULL;
  121. #endif
  122. #if defined SMEXT_ENABLE_MENUS
  123. sm_menus = NULL;
  124. #endif
  125. #if defined SMEXT_ENABLE_ADMINSYS
  126. sm_adminsys = NULL;
  127. #endif
  128. #if defined SMEXT_ENABLE_TEXTPARSERS
  129. sm_text = NULL;
  130. #endif
  131. #if defined SMEXT_ENABLE_TRANSLATOR
  132. sm_translator = NULL;
  133. #endif
  134. }
  135. IExtension *myself = NULL;
  136. IExtensionManager *smexts = NULL;
  137. IShareSys *sharesys = NULL;
  138. SourceMod::ISourceMod *sm_main = NULL;
  139. #if defined SMEXT_ENABLE_FORWARDSYS
  140. SourceMod::IForwardManager *sm_forwards = NULL;
  141. #endif
  142. #if defined SMEXT_ENABLE_HANDLESYS
  143. SourceMod::IHandleSys *sm_handlesys = NULL;
  144. #endif
  145. #if defined SMEXT_ENABLE_PLAYERHELPERS
  146. SourceMod::IPlayerManager *sm_players = NULL;
  147. #endif
  148. #if defined SMEXT_ENABLE_DBMANAGER
  149. SourceMod::IDBManager *sm_dbi = NULL;
  150. #endif
  151. #if defined SMEXT_ENABLE_GAMECONF
  152. SourceMod::IGameConfigManager *sm_gameconfs = NULL;
  153. #endif
  154. #if defined SMEXT_ENABLE_MEMUTILS
  155. SourceMod::IMemoryUtils *sm_memutils = NULL;
  156. #endif
  157. #if defined SMEXT_ENABLE_GAMEHELPERS
  158. SourceMod::IGameHelpers *sm_gamehelpers = NULL;
  159. #endif
  160. #if defined SMEXT_ENABLE_TIMERSYS
  161. SourceMod::ITimerSystem *sm_timersys = NULL;
  162. #endif
  163. #if defined SMEXT_ENABLE_THREADER
  164. SourceMod::IThreader *sm_threader = NULL;
  165. #endif
  166. #if defined SMEXT_ENABLE_LIBSYS
  167. SourceMod::ILibrarySys *sm_libsys = NULL;
  168. #endif
  169. #if defined SMEXT_ENABLE_PLUGINSYS
  170. SourceMod::IPluginManager *sm_plsys = NULL;
  171. #endif
  172. #if defined SMEXT_ENABLE_MENUS
  173. SourceMod::IMenuManager *sm_menus = NULL;
  174. #endif
  175. #if defined SMEXT_ENABLE_ADMINSYS
  176. SourceMod::IAdminSystem *sm_adminsys = NULL;
  177. #endif
  178. #if defined SMEXT_ENABLE_TEXTPARSERS
  179. SourceMod::ITextParsers *sm_text = NULL;
  180. #endif
  181. #if defined SMEXT_ENABLE_TRANSLATOR
  182. SourceMod::ITranslator *sm_translator = NULL;
  183. #endif