From c4e07631c803debf1047a5607c96d9bf5c1e5f95 Mon Sep 17 00:00:00 2001
From: STRWarrior <niels.breuker@hotmail.nl>
Date: Mon, 31 Mar 2014 19:47:18 +0200
Subject: Added new merge strategy "msDifference"

---
 src/BlockArea.cpp | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

(limited to 'src/BlockArea.cpp')

diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 2b950378a..17d3cbb00 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -173,6 +173,25 @@ static inline void MergeCombinatorSpongePrint(BLOCKTYPE & a_DstType, BLOCKTYPE a
 
 
 
+/** Combinator used for cBlockArea::msDifference merging */
+static inline void MergeCombinatorDifference(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
+{
+	if ((a_DstType == a_SrcType) && (a_DstMeta == a_SrcMeta))
+	{
+		a_DstType = E_BLOCK_AIR;
+		a_DstMeta = 0;
+	}
+	else
+	{
+		a_DstType = a_SrcType;
+		a_DstMeta = a_SrcMeta;
+	}
+}
+
+
+
+
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 // cBlockArea:
 
@@ -709,6 +728,21 @@ void cBlockArea::Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_R
 			);
 			break;
 		}  // case msSpongePrint
+
+		case msDifference:
+		{
+			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,
+				MergeCombinatorDifference
+			);
+			break;
+		}	// case msDifference
 		
 		default:
 		{
-- 
cgit v1.2.3


From 1229795ff0fd82412e780fffc9f37a2d6eed5522 Mon Sep 17 00:00:00 2001
From: madmaxoft <github@xoft.cz>
Date: Tue, 1 Apr 2014 20:50:10 +0200
Subject: cBlockArea: Added the msMask merge strategy.

---
 src/BlockArea.cpp | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

(limited to 'src/BlockArea.cpp')

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);
-- 
cgit v1.2.3