summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-03-28 18:03:37 +0100
committermadmaxoft <github@xoft.cz>2014-03-28 18:03:37 +0100
commit8557549cfac260867112be96e24b2c0e059db47e (patch)
treef818ce92a9ed4773d7166a9d0f24c0db0f77beef /src
parentNetherFort: Added BalconyTee2 prefab. (diff)
downloadcuberite-8557549cfac260867112be96e24b2c0e059db47e.tar
cuberite-8557549cfac260867112be96e24b2c0e059db47e.tar.gz
cuberite-8557549cfac260867112be96e24b2c0e059db47e.tar.bz2
cuberite-8557549cfac260867112be96e24b2c0e059db47e.tar.lz
cuberite-8557549cfac260867112be96e24b2c0e059db47e.tar.xz
cuberite-8557549cfac260867112be96e24b2c0e059db47e.tar.zst
cuberite-8557549cfac260867112be96e24b2c0e059db47e.zip
Diffstat (limited to 'src')
-rw-r--r--src/BlockArea.cpp38
-rw-r--r--src/BlockArea.h13
-rw-r--r--src/Generating/Prefabs/NetherFortPrefabs.cpp6
3 files changed, 48 insertions, 9 deletions
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index f6d54e41c..2b950378a 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -54,7 +54,7 @@ template<typename Combinator> void InternalMergeBlocks(
/// Combinator used for cBlockArea::msOverwrite merging
-static void MergeCombinatorOverwrite(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
+static inline void MergeCombinatorOverwrite(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{
a_DstType = a_SrcType;
a_DstMeta = a_SrcMeta;
@@ -65,7 +65,7 @@ static void MergeCombinatorOverwrite(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType,
/// Combinator used for cBlockArea::msFillAir merging
-static void MergeCombinatorFillAir(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
+static inline void MergeCombinatorFillAir(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{
if (a_DstType == E_BLOCK_AIR)
{
@@ -80,7 +80,7 @@ static void MergeCombinatorFillAir(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, N
/// Combinator used for cBlockArea::msImprint merging
-static void MergeCombinatorImprint(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
+static inline void MergeCombinatorImprint(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
{
if (a_SrcType != E_BLOCK_AIR)
{
@@ -95,7 +95,7 @@ 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)
+static inline 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)
@@ -158,6 +158,21 @@ static void MergeCombinatorLake(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBB
+/** Combinator used for cBlockArea::msSpongePrint merging */
+static inline void MergeCombinatorSpongePrint(BLOCKTYPE & a_DstType, BLOCKTYPE a_SrcType, NIBBLETYPE & a_DstMeta, NIBBLETYPE a_SrcMeta)
+{
+ // Sponge overwrites nothing, everything else overwrites anything
+ if (a_SrcType != E_BLOCK_SPONGE)
+ {
+ a_DstType = a_SrcType;
+ a_DstMeta = a_SrcMeta;
+ }
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cBlockArea:
@@ -680,6 +695,21 @@ void cBlockArea::Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_R
break;
} // case msLake
+ case msSpongePrint:
+ {
+ 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,
+ MergeCombinatorSpongePrint
+ );
+ break;
+ } // case msSpongePrint
+
default:
{
LOGWARNING("Unknown block area merge strategy: %d", a_Strategy);
diff --git a/src/BlockArea.h b/src/BlockArea.h
index d28325d7d..d37f0d182 100644
--- a/src/BlockArea.h
+++ b/src/BlockArea.h
@@ -51,6 +51,7 @@ public:
msFillAir,
msImprint,
msLake,
+ msSpongePrint,
} ;
cBlockArea(void);
@@ -127,8 +128,8 @@ public:
- msFillAir overwrites only those blocks that were air
- msImprint overwrites with only those blocks that are non-air
- Special strategies:
- msLake (evaluate top-down, first match wins):
+ Special strategies (evaluate top-down, first match wins):
+ msLake:
| area block | |
| this | Src | result |
+----------+--------+--------+
@@ -143,6 +144,14 @@ public:
| mycelium | stone | stone | ... and mycelium
| A | stone | A | ... but nothing else
| A | * | A | Everything else is left as it is
+
+ msSpongePrint:
+ Used for most generators, it allows carving out air pockets, too, and uses the Sponge as the NOP block
+ | area block | |
+ | this | Src | result |
+ +----------+--------+--------+
+ | A | sponge | A | Sponge is the NOP block
+ | * | B | B | Everything else overwrites anything
*/
void Merge(const cBlockArea & a_Src, int a_RelX, int a_RelY, int a_RelZ, eMergeStrategy a_Strategy);
diff --git a/src/Generating/Prefabs/NetherFortPrefabs.cpp b/src/Generating/Prefabs/NetherFortPrefabs.cpp
index 6d6b11cdd..31eaa5078 100644
--- a/src/Generating/Prefabs/NetherFortPrefabs.cpp
+++ b/src/Generating/Prefabs/NetherFortPrefabs.cpp
@@ -127,7 +127,7 @@ const cPrefab::sDef g_NetherFortPrefabs1[] =
7, /* 1, 2, 3 CCW rotations */
// Merge strategy:
- cBlockArea::msImprint,
+ cBlockArea::msSpongePrint,
}, // BalconyCorridor
@@ -253,7 +253,7 @@ const cPrefab::sDef g_NetherFortPrefabs1[] =
7, /* 1, 2, 3 CCW rotations */
// Merge strategy:
- cBlockArea::msImprint,
+ cBlockArea::msSpongePrint,
},
} ; // g_NetherFortPrefabs1
@@ -421,7 +421,7 @@ const cPrefab::sDef g_NetherFortStartingPrefabs1[] =
7, /* 1, 2, 3 CCW rotations */
// Merge strategy:
- cBlockArea::msImprint,
+ cBlockArea::msSpongePrint,
},
} ; // g_NetherFortStartingPrefabs1