summaryrefslogtreecommitdiffstats
path: root/src/ChunkMap.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-03-31 11:41:52 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-03-31 11:41:52 +0200
commit0f2cebb7861516e1046a81c920a7e12be2747ac6 (patch)
treec9c029db48142bc3d87b6ed6f245237ded472466 /src/ChunkMap.cpp
parentMerge pull request #3109 from LogicParrot/moveToNewWorld (diff)
parentEntities are never lost (diff)
downloadcuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.tar
cuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.tar.gz
cuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.tar.bz2
cuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.tar.lz
cuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.tar.xz
cuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.tar.zst
cuberite-0f2cebb7861516e1046a81c920a7e12be2747ac6.zip
Diffstat (limited to 'src/ChunkMap.cpp')
-rw-r--r--src/ChunkMap.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 660d4a9ea..629acb341 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -1623,11 +1623,8 @@ void cChunkMap::RemoveClientFromChunks(cClientHandle * a_Client)
void cChunkMap::AddEntity(cEntity * a_Entity)
{
cCSLock Lock(m_CSLayers);
- cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), a_Entity->GetChunkZ());
- if (
- (Chunk == nullptr) || // Chunk not present at all
- (!Chunk->IsValid() && !a_Entity->IsPlayer()) // Chunk present, but no valid data; players need to spawn in such chunks (#953)
- )
+ cChunkPtr Chunk = GetChunk(a_Entity->GetChunkX(), a_Entity->GetChunkZ());
+ if (Chunk == nullptr) // This will assert inside GetChunk in Debug builds
{
LOGWARNING("Entity at %p (%s, ID %d) spawning in a non-existent chunk, the entity is lost.",
static_cast<void *>(a_Entity), a_Entity->GetClass(), a_Entity->GetUniqueID()
@@ -1644,11 +1641,8 @@ void cChunkMap::AddEntity(cEntity * a_Entity)
void cChunkMap::AddEntityIfNotPresent(cEntity * a_Entity)
{
cCSLock Lock(m_CSLayers);
- cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), a_Entity->GetChunkZ());
- if (
- (Chunk == nullptr) || // Chunk not present at all
- (!Chunk->IsValid() && !a_Entity->IsPlayer()) // Chunk present, but no valid data; players need to spawn in such chunks (#953)
- )
+ cChunkPtr Chunk = GetChunk(a_Entity->GetChunkX(), a_Entity->GetChunkZ());
+ if (Chunk == nullptr) // This will assert inside GetChunk in Debug builds
{
LOGWARNING("Entity at %p (%s, ID %d) spawning in a non-existent chunk, the entity is lost.",
static_cast<void *>(a_Entity), a_Entity->GetClass(), a_Entity->GetUniqueID()