diff options
author | madmaxoft <github@xoft.cz> | 2014-04-01 20:50:10 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-04-01 20:50:10 +0200 |
commit | 1229795ff0fd82412e780fffc9f37a2d6eed5522 (patch) | |
tree | 865b3ecec47d1cf669c738959f8729ac90ef1d74 /src | |
parent | Removed the exit-time-destructors flag from clang. (diff) | |
download | cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.tar cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.tar.gz cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.tar.bz2 cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.tar.lz cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.tar.xz cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.tar.zst cuberite-1229795ff0fd82412e780fffc9f37a2d6eed5522.zip |
Diffstat (limited to '')
-rw-r--r-- | src/BlockArea.cpp | 30 | ||||
-rw-r--r-- | src/BlockArea.h | 9 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp index 2b950378a..543dbe04d 100644 --- a/src/BlockArea.cpp +++ b/src/BlockArea.cpp @@ -173,6 +173,21 @@ static inline void MergeCombinatorSpongePrint(BLOCKTYPE & a_DstType, BLOCKTYPE a +/** Combinator used for cBlockArea::msMask merging */ +static inline void MergeCombinatorMask(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta) +{ + // If the blocks are the same, keep the dest; otherwise replace with air + if ((a_SrcType != a_DstType) || (a_SrcMeta != a_DstMeta)) + { + a_DstType = E_BLOCK_AIR; + a_DstMeta = 0; + } +} + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cBlockArea: @@ -710,6 +725,21 @@ void cBlockArea::Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_R break; } // case msSpongePrint + case msMask: + { + InternalMergeBlocks( + m_BlockTypes, a_Src.GetBlockTypes(), + DstMetas, SrcMetas, + SizeX, SizeY, SizeZ, + SrcOffX, SrcOffY, SrcOffZ, + DstOffX, DstOffY, DstOffZ, + a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(), + m_Size.x, m_Size.y, m_Size.z, + MergeCombinatorMask + ); + break; + } // case msMask + default: { LOGWARNING("Unknown block area merge strategy: %d", a_Strategy); diff --git a/src/BlockArea.h b/src/BlockArea.h index d37f0d182..34a0ef926 100644 --- a/src/BlockArea.h +++ b/src/BlockArea.h @@ -52,6 +52,7 @@ public: msImprint, msLake, msSpongePrint, + msMask, } ; cBlockArea(void); @@ -152,6 +153,14 @@ public: +----------+--------+--------+ | A | sponge | A | Sponge is the NOP block | * | B | B | Everything else overwrites anything + + msMask: + Combines two areas, the blocks that are the same are kept, differing ones are reset to air + | area block | | + | this | Src | result | + +------+-------+--------+ + | A | A | A | Same blocks are kept + | A | non-A | air | Everything else is replaced with air */ void Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy); |