From 72ae5ecb5a5a8585935be6a954f480a406550b5c Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Fri, 28 Aug 2020 21:22:44 +0100 Subject: ChunkMap: do not wantonly make empty chunks - Removed calls that constructed an empty chunk, found it was invalid, and did nothing with said chunk Partially addresses #2324 --- src/ChunkMap.h | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'src/ChunkMap.h') diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 8fc1a57f9..e426dd298 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -42,7 +42,6 @@ class cBoundingBox; class cDeadlockDetect; typedef std::list cClientHandleList; -typedef cChunk * cChunkPtr; using cEntityCallback = cFunctionRef; using cBeaconCallback = cFunctionRef; using cBedCallback = cFunctionRef; @@ -465,31 +464,11 @@ private: std::unique_ptr > m_Pool; /** Returns or creates and returns a chunk pointer corresponding to the given chunk coordinates. - Emplaces this chunk in the chunk map. - Developers SHOULD use the GetChunk variants instead of this function. */ - cChunkPtr ConstructChunk(int a_ChunkX, int a_ChunkZ); + Emplaces this chunk in the chunk map. */ + cChunk & ConstructChunk(int a_ChunkX, int a_ChunkZ); /** Constructs a chunk and queues it for loading / generating if not valid, returning it */ - cChunkPtr GetChunk(int a_ChunkX, int a_ChunkZ); - - /** Constructs a chunk and queues the chunk for loading if not valid, returning it; doesn't generate */ - cChunkPtr GetChunkNoGen(cChunkCoords a_Chunk); - - // Deprecated in favor of the vector version - cChunkPtr GetChunkNoGen(int a_ChunkX, int a_ChunkZ) - { - return GetChunkNoGen({a_ChunkX, a_ChunkZ}); - } - - /** Constructs a chunk, returning it. Doesn't load, doesn't generate */ - cChunkPtr GetChunkNoLoad(cChunkCoords a_Coords); - - /** OBSOLETE, use the cChunkCoords-based overload instead. - Constructs a chunk, returning it. Doesn't load, doesn't generate */ - cChunkPtr GetChunkNoLoad(int a_ChunkX, int a_ChunkZ) - { - return GetChunkNoLoad({a_ChunkX, a_ChunkZ}); - } + cChunk & GetChunk(int a_ChunkX, int a_ChunkZ); /** Locates a chunk ptr in the chunkmap; doesn't create it when not found; assumes m_CSChunks is locked. To be called only from cChunkMap. */ cChunk * FindChunk(int a_ChunkX, int a_ChunkZ); @@ -503,8 +482,3 @@ private: void DelChunkStay(cChunkStay & a_ChunkStay); }; - - - - - -- cgit v1.2.3