summaryrefslogtreecommitdiffstats
path: root/src/Generating/ChunkDesc.h
diff options
context:
space:
mode:
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: