diff options
author | Mattes D <github@xoft.cz> | 2019-09-24 14:20:50 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2019-09-24 17:38:59 +0200 |
commit | 66e73a2d682f02224a2c84319f6db03964ecbac2 (patch) | |
tree | 681876b2622b843b1cb98cae4a875ac2d7771e75 /src/ChunkMap.h | |
parent | Add ProtocolBlockTypePalette (#4391) (diff) | |
download | cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.tar cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.tar.gz cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.tar.bz2 cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.tar.lz cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.tar.xz cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.tar.zst cuberite-66e73a2d682f02224a2c84319f6db03964ecbac2.zip |
Diffstat (limited to '')
-rw-r--r-- | src/ChunkMap.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 8f0ac3a7c..4a3dd2dfd 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -108,7 +108,9 @@ public: const cChunkDef::BlockNibbles & a_SkyLight ); - bool GetChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataCallback & a_Callback); + /** Calls the callback with the chunk's data, if available (with ChunkCS locked). + Returns true if the chunk was reported successfully, false if not (chunk not present or callback failed). */ + bool GetChunkData(cChunkCoords a_Coords, cChunkDataCallback & a_Callback); /** Copies the chunk's blocktypes into a_Blocks; returns true if successful */ bool GetChunkBlockTypes (int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_Blocks); @@ -439,7 +441,7 @@ private: typedef std::list<cChunkStay *> cChunkStays; - cCriticalSection m_CSChunks; + mutable cCriticalSection m_CSChunks; /** A map of chunk coordinates to chunk pointers Uses a map (as opposed to unordered_map) because sorted maps are apparently faster */ @@ -468,7 +470,7 @@ private: // Deprecated in favor of the vector version cChunkPtr GetChunkNoGen(int a_ChunkX, int a_ChunkZ) { - return GetChunkNoGen(cChunkCoords(a_ChunkX, a_ChunkZ)); + return GetChunkNoGen({a_ChunkX, a_ChunkZ}); } /** Constructs a chunk, returning it. Doesn't load, doesn't generate */ |