summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-05 13:42:09 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-05 13:42:09 +0200
commitd303a60e110bbecd29ab65fb6173e77891a413e6 (patch)
treef0afdd57e46f06b553d133c01a57dff5711aa845 /source
parentEntity: Now entites inside a cobweb slow down their speed (diff)
downloadcuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.tar
cuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.tar.gz
cuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.tar.bz2
cuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.tar.lz
cuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.tar.xz
cuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.tar.zst
cuberite-d303a60e110bbecd29ab65fb6173e77891a413e6.zip
Diffstat (limited to '')
-rw-r--r--source/ChunkDef.h2
-rw-r--r--source/Generating/ChunkDesc.cpp27
-rw-r--r--source/Generating/ChunkDesc.h5
3 files changed, 33 insertions, 1 deletions
diff --git a/source/ChunkDef.h b/source/ChunkDef.h
index 1e368b50b..7f9c0ca98 100644
--- a/source/ChunkDef.h
+++ b/source/ChunkDef.h
@@ -118,7 +118,7 @@ public:
static const unsigned int INDEX_OUT_OF_RANGE = 0xffffffff;
- /// The type used for any heightmap operations and storage; idx = x + Width * z
+ /// The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the highest non-air block in the column
typedef HEIGHTTYPE HeightMap[Width * Width];
/** The type used for any biomemap operations and storage inside MCServer,
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;