summaryrefslogtreecommitdiffstats
path: root/source/BlockArea.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-19 09:32:02 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-19 09:32:02 +0100
commitb4697ab9dbece2afc8d4edbd86678fa8735578b9 (patch)
treec39af3d9dbb0f6323fb05820d2d29ff0ed3b18ea /source/BlockArea.cpp
parentTrees: fixed a glitch in large jungle trees' leaves (1 column was missing) (diff)
downloadcuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.tar
cuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.tar.gz
cuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.tar.bz2
cuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.tar.lz
cuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.tar.xz
cuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.tar.zst
cuberite-b4697ab9dbece2afc8d4edbd86678fa8735578b9.zip
Diffstat (limited to '')
-rw-r--r--source/BlockArea.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/source/BlockArea.cpp b/source/BlockArea.cpp
index 66994f613..61abae716 100644
--- a/source/BlockArea.cpp
+++ b/source/BlockArea.cpp
@@ -92,6 +92,70 @@ static void MergeCombinatorImprint(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, N
+/// Combinator used for cBlockArea::msLake merging
+static void MergeCombinatorLake(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
+{
+ // Sponge is the NOP block
+ if (a_SrcType == E_BLOCK_SPONGE)
+ {
+ return;
+ }
+
+ // Air is always hollowed out
+ if (a_SrcType == E_BLOCK_AIR)
+ {
+ a_DstType = E_BLOCK_AIR;
+ a_DstMeta = 0;
+ return;
+ }
+
+ // Water and lava are never overwritten
+ switch (a_DstType)
+ {
+ case E_BLOCK_WATER:
+ case E_BLOCK_STATIONARY_WATER:
+ case E_BLOCK_LAVA:
+ case E_BLOCK_STATIONARY_LAVA:
+ {
+ return;
+ }
+ }
+
+ // Water and lava always overwrite
+ switch (a_SrcType)
+ {
+ case E_BLOCK_WATER:
+ case E_BLOCK_STATIONARY_WATER:
+ case E_BLOCK_LAVA:
+ case E_BLOCK_STATIONARY_LAVA:
+ {
+ a_DstType = a_SrcType;
+ a_DstMeta = a_DstMeta;
+ return;
+ }
+ }
+
+ if (a_SrcType == E_BLOCK_STONE)
+ {
+ switch (a_DstType)
+ {
+ case E_BLOCK_DIRT:
+ case E_BLOCK_GRASS:
+ case E_BLOCK_MYCELIUM:
+ {
+ a_DstType = E_BLOCK_STONE;
+ a_DstMeta = 0;
+ return;
+ }
+ }
+ }
+ // Everything else is left as it is
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cBlockArea:
@@ -611,6 +675,21 @@ void cBlockArea::Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_R
break;
} // case msImprint
+ case msLake:
+ {
+ 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_SizeX, m_SizeY, m_SizeZ,
+ MergeCombinatorLake
+ );
+ break;
+ } // case msLake
+
default:
{
LOGWARNING("Unknown block area merge strategy: %d", a_Strategy);