summaryrefslogtreecommitdiffstats
path: root/src/Generating/ChunkDesc.h
diff options
context:
space:
mode:
authorNiels Breuker <niels.breuker@hotmail.nl>2024-03-22 12:46:11 +0100
committerNiels Breuker <niels.breuker@hotmail.nl>2024-03-22 12:46:11 +0100
commitf9f73ca5d5beb59d59c18b02562b96f7db515806 (patch)
tree9f4eb8f84364dfde3308be9ac2460efc15aea3a0 /src/Generating/ChunkDesc.h
parentMoved end generator back to 3d perlin noise (diff)
downloadcuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar
cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.gz
cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.bz2
cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.lz
cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.xz
cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.tar.zst
cuberite-f9f73ca5d5beb59d59c18b02562b96f7db515806.zip
Diffstat (limited to 'src/Generating/ChunkDesc.h')
-rw-r--r--src/Generating/ChunkDesc.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h
index d10159dc9..d066660f1 100644
--- a/src/Generating/ChunkDesc.h
+++ b/src/Generating/ChunkDesc.h
@@ -87,6 +87,24 @@ public:
/** Sets the shape in a_Shape to match the heightmap stored currently in m_HeightMap. */
void GetShapeFromHeight(Shape & a_Shape) const;
+ /** Returns the index into the internal shape array for the specified coords */
+ inline static size_t MakeShapeIndex(int a_X, int a_Y, int a_Z)
+ {
+ return static_cast<size_t>(a_Y + a_X * cChunkDef::Height + a_Z * cChunkDef::Height * cChunkDef::Width);
+ }
+
+ inline static void SetShapeIsSolidAt(Shape & a_Shape, int a_X, int a_Y, int a_Z, bool a_IsSolid)
+ {
+ auto index = MakeShapeIndex(a_X, a_Y, a_Z);
+ a_Shape[index] = a_IsSolid ? 1 : 0;
+ }
+
+ inline static bool GetShapeIsSolidAt(const Shape & a_Shape, int a_X, int a_Y, int a_Z)
+ {
+ auto index = MakeShapeIndex(a_X, a_Y, a_Z);
+ return a_Shape[index];
+ }
+
// tolua_begin
// Default generation: