From 61b677c073d61fb9f37494db4c009d0db1bf3807 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Fri, 19 Nov 2010 23:02:27 -0500 Subject: [PATCH] Add GetGameRules to ISDKTools (bug 4707, r=fyren) --- extensions/sdktools/extension.cpp | 8 ++++++++ public/extensions/ISDKTools.h | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/extensions/sdktools/extension.cpp b/extensions/sdktools/extension.cpp index ba175808..bf204a6f 100644 --- a/extensions/sdktools/extension.cpp +++ b/extensions/sdktools/extension.cpp @@ -441,6 +441,14 @@ public: { return iserver; } + + virtual void *GetGameRules() + { + if (!g_pGameRules) + return NULL; + + return *g_pGameRules; + } } g_SDKTools_API; static void InitSDKToolsAPI() diff --git a/public/extensions/ISDKTools.h b/public/extensions/ISDKTools.h index 289f41d1..f6afaa66 100644 --- a/public/extensions/ISDKTools.h +++ b/public/extensions/ISDKTools.h @@ -35,7 +35,7 @@ #include #define SMINTERFACE_SDKTOOLS_NAME "ISDKTools" -#define SMINTERFACE_SDKTOOLS_VERSION 1 +#define SMINTERFACE_SDKTOOLS_VERSION 2 class IServer; @@ -61,6 +61,13 @@ namespace SourceMod * @return IServer pointer, or NULL if SDKTools was unable to find one. */ virtual IServer* GetIServer() = 0; + + /** + * @brief Returns a pointer to game's CGameRules class. + * + * @return CGameRules pointer or NULL if not found. + */ + virtual void* GetGameRules() = 0; }; }