From d838ef7ba4e805d1620dfa4de8215bdfed1207fc Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Mon, 3 Jul 2017 17:34:27 +0100 Subject: cBlockInfo static initialisation (#3832) --- tests/SchematicFileSerializer/Stubs.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/SchematicFileSerializer/Stubs.cpp') 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(i)); + BlockInfos[i].m_Handler.reset(new cBlockHandler(static_cast(i))); } } -- cgit v1.2.3