summaryrefslogtreecommitdiffstats
path: root/src/BlockArea.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/BlockArea.h')
-rw-r--r--src/BlockArea.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/BlockArea.h b/src/BlockArea.h
index 856df542f..a9963b4ef 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -308,6 +308,15 @@ public:
Returns 0 if blocktypes not available. Block metas are ignored (if present, air with any meta is still considered air). */
size_t CountNonAirBlocks(void) const;
+ /** Returns how many times the specified block is contained in the area.
+ The blocks' meta values are ignored, only the blocktype is compared. */
+ size_t CountSpecificBlocks(BLOCKTYPE a_BlockType) const;
+
+ /** Returns how many times the specified block is contained in the area.
+ Both the block's type and meta must match in order to be counted in.
+ If the block metas aren't present in the area, logs a warning and ignores the meta specification. */
+ size_t CountSpecificBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) const;
+
// tolua_end
/** Returns the minimum and maximum coords in each direction for the first non-ignored block in each direction.
@@ -321,7 +330,7 @@ public:
NIBBLETYPE * GetBlockMetas (void) const { return m_BlockMetas; } // NOTE: one byte per block!
NIBBLETYPE * GetBlockLight (void) const { return m_BlockLight; } // NOTE: one byte per block!
NIBBLETYPE * GetBlockSkyLight(void) const { return m_BlockSkyLight; } // NOTE: one byte per block!
- size_t GetBlockCount(void) const { return (size_t)(m_Size.x * m_Size.y * m_Size.z); }
+ size_t GetBlockCount(void) const { return static_cast<size_t>(m_Size.x * m_Size.y * m_Size.z); }
int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const;
protected: