From 33b9c5dc6dae42fb6fc33283ded888a8001e5394 Mon Sep 17 00:00:00 2001 From: hle0 <91701075+hle0@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:05:47 -0500 Subject: Fix cChunkMap issues below with coords below y=0 (#5397) * return false in cChunkMap::GetBlockTypeMeta if requested height is invalid * add checks to users of cWorld::GetBlockTypeMeta * add checks for invalid height to cChunkMap::GetBlock and cChunkMap::GetBlockMeta * add hle0 to CONTRIBUTORS * Fix merge conflict with isValidHeight * Add initialisation contract and fulfil it. --------- Co-authored-by: Alexander Harkness --- src/ChunkMap.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ChunkMap.h') diff --git a/src/ChunkMap.h b/src/ChunkMap.h index 578c49b8a..8538b7624 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -115,6 +115,10 @@ public: void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_BlockMeta); void SetBlock (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); + /** Get the block type and meta at the specified coords + Will always initialise a_BlockType and a_BlockMeta if called. + Returns false if the data could not be retrieved, either because the chunk is invalid or the height is invalid. + Otherwise, returns true. */ bool GetBlockTypeMeta (Vector3i a_BlockPos, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const; bool GetBlockInfo (Vector3i, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) const; -- cgit v1.2.3