summaryrefslogtreecommitdiffstats
path: root/source/Generating
diff options
context:
space:
mode:
Diffstat (limited to 'source/Generating')
-rw-r--r--source/Generating/ChunkDesc.cpp27
-rw-r--r--source/Generating/ChunkDesc.h5
2 files changed, 32 insertions, 0 deletions
diff --git a/source/Generating/ChunkDesc.cpp b/source/Generating/ChunkDesc.cpp
index 68feb463d..ff331e6e4 100644
--- a/source/Generating/ChunkDesc.cpp
+++ b/source/Generating/ChunkDesc.cpp
@@ -547,3 +547,30 @@ void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
+
+#ifdef _DEBUG
+
+void cChunkDesc::VerifyHeightmap(void)
+{
+ for (int x = 0; x < cChunkDef::Width; x++)
+ {
+ for (int z = 0; z < cChunkDef::Width; z++)
+ {
+ for (int y = cChunkDef::Height - 1; y > 0; y--)
+ {
+ if (GetBlockType(x, y, z) != E_BLOCK_AIR)
+ {
+ ASSERT(GetHeight(x, z) == y);
+ break;
+ }
+ } // for y
+ } // for z
+ } // for x
+}
+
+#endif // _DEBUG
+
+
+
+
+
diff --git a/source/Generating/ChunkDesc.h b/source/Generating/ChunkDesc.h
index a25d0a720..bc952fbe4 100644
--- a/source/Generating/ChunkDesc.h
+++ b/source/Generating/ChunkDesc.h
@@ -183,6 +183,11 @@ public:
/// Compresses the metas from the BlockArea format (1 meta per byte) into regular format (2 metas per byte)
void CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas);
+ #ifdef _DEBUG
+ /// Verifies that the heightmap corresponds to blocktype contents; if not, asserts on that column
+ void VerifyHeightmap(void);
+ #endif // _DEBUG
+
private:
int m_ChunkX;
int m_ChunkZ;