summaryrefslogtreecommitdiffstats
path: root/src/Generating/ChunkDesc.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2020-04-03 23:23:38 +0200
committerGitHub <noreply@github.com>2020-04-03 23:23:38 +0200
commitaac592f98598aae327d07b2a1bb155e33c6d51b1 (patch)
tree24f90211d753a7ec87585e919ef7c7acdfa49909 /src/Generating/ChunkDesc.cpp
parentNew hotfix to prevent calling OnBroken (#4600) (diff)
downloadcuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.gz
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.bz2
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.lz
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.xz
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.tar.zst
cuberite-aac592f98598aae327d07b2a1bb155e33c6d51b1.zip
Diffstat (limited to 'src/Generating/ChunkDesc.cpp')
-rw-r--r--src/Generating/ChunkDesc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Generating/ChunkDesc.cpp b/src/Generating/ChunkDesc.cpp
index 060901bba..340e3f805 100644
--- a/src/Generating/ChunkDesc.cpp
+++ b/src/Generating/ChunkDesc.cpp
@@ -578,7 +578,7 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
if (itr != m_BlockEntities.end())
{
// Already in the list:
- cBlockEntity * BlockEntity = itr->second;
+ cBlockEntity * BlockEntity = itr->second.get();
if (BlockEntity->GetBlockType() == GetBlockType(a_RelX, a_RelY, a_RelZ))
{
// Correct type, already present. Return it:
@@ -595,14 +595,14 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
int AbsZ = a_RelZ + m_Coords.m_ChunkZ * cChunkDef::Width;
// The block entity is not created yet, try to create it and add to list:
- cBlockEntity * be = cBlockEntity::CreateByBlockType(GetBlockType(a_RelX, a_RelY, a_RelZ), GetBlockMeta(a_RelX, a_RelY, a_RelZ), {AbsX, a_RelY, AbsZ});
+ auto be = cBlockEntity::CreateByBlockType(GetBlockType(a_RelX, a_RelY, a_RelZ), GetBlockMeta(a_RelX, a_RelY, a_RelZ), {AbsX, a_RelY, AbsZ});
if (be == nullptr)
{
// No block entity for this block type
return nullptr;
}
- m_BlockEntities.insert({ Idx, be });
- return be;
+ auto res = m_BlockEntities.emplace(Idx, std::move(be));
+ return res.first->second.get();
}