1
0

ChunkDesc: Added heightmap verification (DEBUG-only), not used yet

git-svn-id: http://mc-server.googlecode.com/svn/trunk@1443 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2013-05-05 11:42:09 +00:00
parent accb2971f1
commit d303a60e11
3 changed files with 33 additions and 1 deletions

View File

@ -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,

View File

@ -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

View File

@ -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;