diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-02-10 16:15:41 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-02-10 16:15:41 +0100 |
commit | 345da37e96bb5f1fff04e419de0364d497b1b52e (patch) | |
tree | eb2b7f84630ce53d3fa66912626c38046aee53b1 /source/BlockArea.h | |
parent | Fixed ASSERT / VERIFY mismatch in ManualBindings' error handling (diff) | |
download | cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.tar cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.tar.gz cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.tar.bz2 cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.tar.lz cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.tar.xz cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.tar.zst cuberite-345da37e96bb5f1fff04e419de0364d497b1b52e.zip |
Diffstat (limited to '')
-rw-r--r-- | source/BlockArea.h | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/source/BlockArea.h b/source/BlockArea.h index b1a2d9053..787731434 100644 --- a/source/BlockArea.h +++ b/source/BlockArea.h @@ -44,6 +44,13 @@ public: baSkyLight = 8,
} ;
+ enum eMergeStrategy
+ {
+ msOverwrite,
+ msFillAir,
+ msImprint,
+ } ;
+
cBlockArea(void);
~cBlockArea();
@@ -80,6 +87,25 @@ public: /// Expands the internal contents by the specified amount of blocks from each border
void Expand(int a_SubMinX, int a_AddMaxX, int a_SubMinY, int a_AddMaxY, int a_SubMinZ, int a_AddMaxZ);
+ /** Merges another block area into this one, using the specified block combinating strategy
+ This function combines another BlockArea into the current object.
+ The strategy parameter specifies how individual blocks are combined together, using the table below.
+
+ | area block | result |
+ | this | Src | msOverwrite | msFillAir | msImprint |
+ +------+-----+-------------+-----------+-----------+
+ | air | air | air | air | air |
+ | A | air | air | A | A |
+ | air | B | B | B | B |
+ | A | B | B | A | B |
+
+ So to sum up:
+ - msOverwrite completely overwrites all blocks with the Src's blocks
+ - msFillAir overwrites only those blocks that were air
+ - msImprint overwrites with only those blocks that are non-air
+ */
+ void Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy);
+
// Setters:
void SetRelBlockType (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType);
void SetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType);
@@ -125,10 +151,10 @@ public: // Clients can use these for faster access to all blocktypes. Be careful though!
/// Returns the internal pointer to the block types
- BLOCKTYPE * GetBlockTypes (void) { return m_BlockTypes; }
- NIBBLETYPE * GetBlockMetas (void) { return m_BlockMetas; } // NOTE: one byte per block!
- NIBBLETYPE * GetBlockLight (void) { return m_BlockLight; } // NOTE: one byte per block!
- NIBBLETYPE * GetBlockSkyLight(void) { return m_BlockSkyLight; } // NOTE: one byte per block!
+ BLOCKTYPE * GetBlockTypes (void) const { return m_BlockTypes; }
+ 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!
int GetBlockCount(void) const { return m_SizeX * m_SizeY * m_SizeZ; }
int MakeIndex(int a_RelX, int a_RelY, int a_RelZ) const;
|