Add ICellArray and create/free in ISourceMod
Add an ICellArray interface to expose the adt_array CellArray class from logic to core. Add methods to ISourceMod to create and delete ICellArray instances in logic.
This commit is contained in:
+15
-2
@@ -34,10 +34,11 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ICellArray.h>
|
||||
|
||||
extern HandleType_t htCellArray;
|
||||
|
||||
class CellArray
|
||||
class CellArray : public ICellArray
|
||||
{
|
||||
public:
|
||||
CellArray(size_t blocksize) : m_Data(NULL), m_BlockSize(blocksize), m_AllocSize(0), m_Size(0)
|
||||
@@ -49,6 +50,18 @@ public:
|
||||
free(m_Data);
|
||||
}
|
||||
|
||||
static ICellArray *New(size_t blocksize)
|
||||
{
|
||||
return new CellArray(blocksize);
|
||||
}
|
||||
|
||||
static void Free(ICellArray *arr)
|
||||
{
|
||||
delete arr;
|
||||
}
|
||||
|
||||
// ICellArray
|
||||
public:
|
||||
size_t size() const
|
||||
{
|
||||
return m_Size;
|
||||
@@ -154,7 +167,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
CellArray *clone()
|
||||
ICellArray *clone()
|
||||
{
|
||||
CellArray *array = new CellArray(m_BlockSize);
|
||||
array->m_AllocSize = m_AllocSize;
|
||||
|
||||
Reference in New Issue
Block a user