From ecbedb7b113300cea55548cd92957d124f396cf3 Mon Sep 17 00:00:00 2001 From: Peace-Maker Date: Fri, 26 Aug 2016 15:09:18 -0700 Subject: [PATCH] Don't expose CellArrays in ISourceMod to extensions Don't let extensions have access to the internal implementation of cell arrays. --- core/logic/CellArray.h | 13 +++++++++++++ core/sourcemod.cpp | 10 ---------- core/sourcemod.h | 2 -- public/ISourceMod.h | 20 +------------------- 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/core/logic/CellArray.h b/core/logic/CellArray.h index 4bdd7936..6cea7b91 100644 --- a/core/logic/CellArray.h +++ b/core/logic/CellArray.h @@ -50,11 +50,24 @@ public: free(m_Data); } + /** + * @brief Creates a cell array object. + * + * @param blocksize The number of cells each member of the array can + * hold. For example, 32 cells is equivalent to: + * new Array[X][32] + * @return A new ICellArray object. + */ static ICellArray *New(size_t blocksize) { return new CellArray(blocksize); } + /** + * @brief Releases a cell array's resources. + * + * @param pack An ICellArray object to release. + */ static void Free(ICellArray *arr) { delete arr; diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index fb0fb50e..5522a7ec 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -745,16 +745,6 @@ bool SourceModBase::IsMapRunning() return g_OnMapStarted; } -ICellArray *SourceModBase::CreateCellArray(size_t blocksize) -{ - return logicore.CreateCellArray(blocksize); -} - -void SourceModBase::FreeCellArray(ICellArray *arr) -{ - logicore.FreeCellArray(arr); -} - class ConVarRegistrar : public IConCommandBaseAccessor, public SMGlobalClass diff --git a/core/sourcemod.h b/core/sourcemod.h index e544259a..db16772f 100644 --- a/core/sourcemod.h +++ b/core/sourcemod.h @@ -135,8 +135,6 @@ public: // ISourceMod int GetPluginId(); int GetShApiVersion(); bool IsMapRunning(); - ICellArray *CreateCellArray(size_t blocksize); - void FreeCellArray(ICellArray *arr); private: void ShutdownServices(); private: diff --git a/public/ISourceMod.h b/public/ISourceMod.h index 839cc273..f558a75e 100644 --- a/public/ISourceMod.h +++ b/public/ISourceMod.h @@ -40,11 +40,10 @@ #include #include #include -#include #include #define SMINTERFACE_SOURCEMOD_NAME "ISourceMod" -#define SMINTERFACE_SOURCEMOD_VERSION 14 +#define SMINTERFACE_SOURCEMOD_VERSION 13 /** * @brief Forward declaration of the KeyValues class. @@ -319,23 +318,6 @@ namespace SourceMod * @return True if a map is currently running, otherwise false. */ virtual bool IsMapRunning() = 0; - - /** - * @brief Creates a cell array object. - * - * @param blocksize The number of cells each member of the array can - * hold. For example, 32 cells is equivalent to: - * new Array[X][32] - * @return A new ICellArray object. - */ - virtual ICellArray *CreateCellArray(size_t blocksize) = 0; - - /** - * @brief Releases a cell array's resources so it can be re-used. - * - * @param pack An ICellArray object to release. - */ - virtual void FreeCellArray(ICellArray *arr) = 0; }; }