From 630ceed2c0572df2cf5c34b66b185d021200b806 Mon Sep 17 00:00:00 2001 From: LogicParrot Date: Tue, 29 Mar 2016 21:23:53 +0300 Subject: Entities are never lost --- src/ChunkMap.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/ChunkMap.cpp') 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(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(a_Entity), a_Entity->GetClass(), a_Entity->GetUniqueID() -- cgit v1.2.3