summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-07-03 18:34:27 +0200
committerLukas Pioch <lukas@zgow.de>2017-07-03 18:34:27 +0200
commitd838ef7ba4e805d1620dfa4de8215bdfed1207fc (patch)
tree13e1156490ff60b4cd4974dc2f53c71c2f116382 /tests
parentAdded new Cuberite backers from bountysource. (diff)
downloadcuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.tar
cuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.tar.gz
cuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.tar.bz2
cuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.tar.lz
cuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.tar.xz
cuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.tar.zst
cuberite-d838ef7ba4e805d1620dfa4de8215bdfed1207fc.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/Generating/Stubs.cpp10
-rw-r--r--tests/LuaThreadStress/Stubs.cpp10
-rw-r--r--tests/SchematicFileSerializer/Stubs.cpp10
3 files changed, 18 insertions, 12 deletions
diff --git a/tests/Generating/Stubs.cpp b/tests/Generating/Stubs.cpp
index b9e171b97..0a9f431f4 100644
--- a/tests/Generating/Stubs.cpp
+++ b/tests/Generating/Stubs.cpp
@@ -85,21 +85,23 @@ extern "C" int luaopen_lxp(lua_State * a_LuaState)
-cBlockInfo::~cBlockInfo()
+void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler)
{
+ delete a_Handler;
}
-void cBlockInfo::Initialize(cBlockInfo::cBlockInfoArray & a_BlockInfos)
+cBlockInfo::cBlockInfoArray::cBlockInfoArray()
{
+ cBlockInfoArray & BlockInfos = *this;
// The piece-loading code uses the handlers for rotations, so we need valid handlers
// Insert dummy handlers:
- for (size_t i = 0; i < ARRAYCOUNT(a_BlockInfos); i++)
+ for (size_t i = 0; i < BlockInfos.size(); i++)
{
- a_BlockInfos[i].m_Handler = new cBlockHandler(static_cast<BLOCKTYPE>(i));
+ BlockInfos[i].m_Handler.reset(new cBlockHandler(static_cast<BLOCKTYPE>(i)));
}
}
diff --git a/tests/LuaThreadStress/Stubs.cpp b/tests/LuaThreadStress/Stubs.cpp
index b9e171b97..0a9f431f4 100644
--- a/tests/LuaThreadStress/Stubs.cpp
+++ b/tests/LuaThreadStress/Stubs.cpp
@@ -85,21 +85,23 @@ extern "C" int luaopen_lxp(lua_State * a_LuaState)
-cBlockInfo::~cBlockInfo()
+void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler)
{
+ delete a_Handler;
}
-void cBlockInfo::Initialize(cBlockInfo::cBlockInfoArray & a_BlockInfos)
+cBlockInfo::cBlockInfoArray::cBlockInfoArray()
{
+ cBlockInfoArray & BlockInfos = *this;
// The piece-loading code uses the handlers for rotations, so we need valid handlers
// Insert dummy handlers:
- for (size_t i = 0; i < ARRAYCOUNT(a_BlockInfos); i++)
+ for (size_t i = 0; i < BlockInfos.size(); i++)
{
- a_BlockInfos[i].m_Handler = new cBlockHandler(static_cast<BLOCKTYPE>(i));
+ BlockInfos[i].m_Handler.reset(new cBlockHandler(static_cast<BLOCKTYPE>(i)));
}
}
diff --git a/tests/SchematicFileSerializer/Stubs.cpp b/tests/SchematicFileSerializer/Stubs.cpp
index 00f873b7a..74898fe50 100644
--- a/tests/SchematicFileSerializer/Stubs.cpp
+++ b/tests/SchematicFileSerializer/Stubs.cpp
@@ -13,21 +13,23 @@
-cBlockInfo::~cBlockInfo()
+void cBlockInfo::sHandlerDeleter::operator () (cBlockHandler * a_Handler)
{
+ delete a_Handler;
}
-void cBlockInfo::Initialize(cBlockInfo::cBlockInfoArray & a_BlockInfos)
+cBlockInfo::cBlockInfoArray::cBlockInfoArray()
{
+ cBlockInfoArray & BlockInfos = *this;
// The piece-loading code uses the handlers for rotations, so we need valid handlers
// Insert dummy handlers:
- for (size_t i = 0; i < ARRAYCOUNT(a_BlockInfos); i++)
+ for (size_t i = 0; i < BlockInfos.size(); i++)
{
- a_BlockInfos[i].m_Handler = new cBlockHandler(static_cast<BLOCKTYPE>(i));
+ BlockInfos[i].m_Handler.reset(new cBlockHandler(static_cast<BLOCKTYPE>(i)));
}
}