From c4e07631c803debf1047a5607c96d9bf5c1e5f95 Mon Sep 17 00:00:00 2001
From: STRWarrior
Date: Mon, 31 Mar 2014 19:47:18 +0200
Subject: [PATCH 1/5] Added new merge strategy "msDifference"
---
src/BlockArea.cpp | 34 ++++++++++++++++++++++++++++++++++
src/BlockArea.h | 1 +
2 files changed, 35 insertions(+)
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:
{
diff --git a/src/BlockArea.h b/src/BlockArea.h
index d37f0d182..0bb272fd9 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -52,6 +52,7 @@ public:
msImprint,
msLake,
msSpongePrint,
+ msDifference,
} ;
cBlockArea(void);
From f7df8e133b66aafcf35f0590a0ac525a7d2f9278 Mon Sep 17 00:00:00 2001
From: STRWarrior
Date: Mon, 31 Mar 2014 19:58:19 +0200
Subject: [PATCH 2/5] Documented msDifference
---
MCServer/Plugins/APIDump/APIDesc.lua | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 6f8a14421..532b4b665 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -230,22 +230,22 @@ g_APIDesc =
- area block | result |
+ area block | result |
- this | Src | msOverwrite | msFillAir | msImprint |
+ this | Src | msOverwrite | msFillAir | msImprint | msDifference |
- air | air | air | air | air |
+ air | air | air | air | air | air |
- A | air | air | A | A |
+ A | air | air | A | A | air |
- air | B | B | B | B |
+ air | B | B | B | B | B |
- A | B | B | A | B |
+ A | B | B | A | B | B |
@@ -255,6 +255,8 @@ g_APIDesc =
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
+ msSpongePrint Sponge overwrites nothing, everything else overwrites anything
+ msDifference changes all the blocks wich are the same to air. Otherwise the source block gets placed.
From a8bc27f8728a0c1f222871cbd3f5534646e59085 Mon Sep 17 00:00:00 2001
From: STRWarrior
Date: Mon, 31 Mar 2014 20:05:48 +0200
Subject: [PATCH 3/5] Fixed typo
---
MCServer/Plugins/APIDump/APIDesc.lua | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 532b4b665..1b020501c 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -256,7 +256,7 @@ g_APIDesc =
msFillAir overwrites only those blocks that were air
msImprint overwrites with only those blocks that are non-air
msSpongePrint Sponge overwrites nothing, everything else overwrites anything
- msDifference changes all the blocks wich are the same to air. Otherwise the source block gets placed.
+ msDifference changes all the blocks which are the same to air. Otherwise the source block gets placed.
From b19022fc7ea4cb6bd1bc6f4b212478e65b5fa5a1 Mon Sep 17 00:00:00 2001
From: STRWarrior
Date: Mon, 31 Mar 2014 20:13:08 +0200
Subject: [PATCH 4/5] Added extra table which should make it more clear what
msDifference does.
---
MCServer/Plugins/APIDump/APIDesc.lua | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 1b020501c..657ac6aa6 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -247,6 +247,9 @@ g_APIDesc =
A | B | B | A | B | B |
+
+ A | A | A | A | B | air |
+
@@ -255,7 +258,6 @@ g_APIDesc =
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
- msSpongePrint Sponge overwrites nothing, everything else overwrites anything
msDifference changes all the blocks which are the same to air. Otherwise the source block gets placed.
From 21e0607e49745f0a431fa045967cc45679ab22de Mon Sep 17 00:00:00 2001
From: STRWarrior
Date: Tue, 1 Apr 2014 21:12:48 +0200
Subject: [PATCH 5/5] APIDump: Gave msDifference it's own table.
---
MCServer/Plugins/APIDump/APIDesc.lua | 30 +++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua
index 657ac6aa6..b01be6118 100644
--- a/MCServer/Plugins/APIDump/APIDesc.lua
+++ b/MCServer/Plugins/APIDump/APIDesc.lua
@@ -230,25 +230,25 @@ g_APIDesc =
- area block | result |
+ area block | result |
- this | Src | msOverwrite | msFillAir | msImprint | msDifference |
+ this | Src | msOverwrite | msFillAir | msImprint |
- air | air | air | air | air | air |
+ air | air | air | air | air |
- A | air | air | A | A | air |
+ A | air | air | A | A |
- air | B | B | B | B | B |
+ air | B | B | B | B |
- A | B | B | A | B | B |
+ A | B | B | A | B |
- A | A | A | A | B | air |
+ A | A | A | A | A |
@@ -258,13 +258,25 @@ g_APIDesc =
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
- msDifference changes all the blocks which are the same to air. Otherwise the source block gets placed.
Special strategies
For each strategy, evaluate the table rows from top downwards, the first match wins.
-
+
+
+ msDifference - changes all the blocks which are the same to air. Otherwise the source block gets placed.
+
+
+ area block | | Notes |
+
+ * | B | B | The blocks are different so we use block B |
+
+ B | B | Air | The blocks are the same so we get air. |
+
+
+
+
msLake - used for merging areas with lava and water lakes, in the appropriate generator.