summaryrefslogtreecommitdiffstats
path: root/src/Generating/ChunkDesc.h
diff options
context:
space:
mode:
authorNiLSPACE <NiLSPACE@users.noreply.github.com>2024-04-09 15:11:26 +0200
committerGitHub <noreply@github.com>2024-04-09 15:11:26 +0200
commitcc6459bf0e5d46edf572472ef63b6dc40b59e261 (patch)
tree887ec395a0c3a3f2cf6764b8e3ade3e11aae0cd3 /src/Generating/ChunkDesc.h
parentPlugin InfoDump: Fall back to gPluginInfo if g_PluginInfo not found. (diff)
downloadcuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.tar
cuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.tar.gz
cuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.tar.bz2
cuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.tar.lz
cuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.tar.xz
cuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.tar.zst
cuberite-cc6459bf0e5d46edf572472ef63b6dc40b59e261.zip
Diffstat (limited to '')
-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: