diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2017-08-18 12:17:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-18 12:17:56 +0200 |
commit | 72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82 (patch) | |
tree | c1c1a040332d4ba1f784be25c67c9800e85015eb /src/Simulator | |
parent | Sitting cats block enderchests from opening (#3906) (diff) | |
parent | Changed entity ownership model to use smart pointers (diff) | |
download | cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.tar cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.tar.gz cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.tar.bz2 cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.tar.lz cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.tar.xz cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.tar.zst cuberite-72d7027861a3b7e7e8bb5fdcbbc5a1a778fa7f82.zip |
Diffstat (limited to 'src/Simulator')
-rw-r--r-- | src/Simulator/SandSimulator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp index c26452d98..01e699b49 100644 --- a/src/Simulator/SandSimulator.cpp +++ b/src/Simulator/SandSimulator.cpp @@ -60,11 +60,11 @@ void cSandSimulator::SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, Pos.x, Pos.y, Pos.z, ItemTypeToString(BlockType).c_str(), ItemTypeToString(BlockBelow).c_str() ); */ - cFallingBlock * FallingBlock = new cFallingBlock(Pos, BlockType, a_Chunk->GetMeta(itr->x, itr->y, itr->z)); - if (!FallingBlock->Initialize(m_World)) + + auto FallingBlock = cpp14::make_unique<cFallingBlock>(Pos, BlockType, a_Chunk->GetMeta(itr->x, itr->y, itr->z)); + auto FallingBlockPtr = FallingBlock.get(); + if (!FallingBlockPtr->Initialize(std::move(FallingBlock), m_World)) { - delete FallingBlock; - FallingBlock = nullptr; continue; } a_Chunk->SetBlock(itr->x, itr->y, itr->z, E_BLOCK_AIR, 0); |