summaryrefslogtreecommitdiffstats
path: root/src/Generating/Prefab.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-17 15:22:43 +0200
committerMattes D <github@xoft.cz>2015-06-18 23:32:43 +0200
commitae1668942059b68580c83adc43ee9fb06e1e13f2 (patch)
treee093e9e6667876f6c5e7a3fccec0bb619022b7dd /src/Generating/Prefab.cpp
parentLuaState: Added support for config-style usage. (diff)
downloadcuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.tar
cuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.tar.gz
cuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.tar.bz2
cuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.tar.lz
cuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.tar.xz
cuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.tar.zst
cuberite-ae1668942059b68580c83adc43ee9fb06e1e13f2.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/Prefab.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index 1de0346bd..e5e6a1e06 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -166,6 +166,45 @@ cPrefab::cPrefab(const cBlockArea & a_Image, int a_AllowedRotations) :
+cPrefab::cPrefab(const cBlockArea & a_Image) :
+ m_Size(a_Image.GetSize()),
+ m_AllowedRotations(0),
+ m_MergeStrategy(cBlockArea::msOverwrite),
+ m_ShouldExtendFloor(false),
+ m_DefaultWeight(1),
+ m_AddWeightIfSame(0),
+ m_MoveToGround(false)
+{
+ m_HitBox.p1.Set(0, 0, 0);
+ m_HitBox.p2.Set(m_Size.x - 1, m_Size.y - 1, m_Size.z - 1);
+ m_BlockArea[0].CopyFrom(a_Image);
+}
+
+
+
+
+
+cPrefab::cPrefab(const AString & a_BlockDefinitions, const AString & a_BlockData, int a_SizeX, int a_SizeY, int a_SizeZ) :
+ m_Size(a_SizeX, a_SizeY, a_SizeZ),
+ m_AllowedRotations(0),
+ m_MergeStrategy(cBlockArea::msOverwrite),
+ m_ShouldExtendFloor(false),
+ m_DefaultWeight(1),
+ m_AddWeightIfSame(0),
+ m_MoveToGround(false)
+{
+ m_HitBox.p1.Set(0, 0, 0);
+ m_HitBox.p2.Set(m_Size.x - 1, m_Size.y - 1, m_Size.z - 1);
+ m_BlockArea[0].Create(m_Size);
+ CharMap cm;
+ ParseCharMap(cm, a_BlockDefinitions.c_str());
+ ParseBlockImage(cm, a_BlockData.c_str());
+}
+
+
+
+
+
void cPrefab::AddRotatedBlockAreas(void)
{
// 1 CCW rotation:
@@ -326,6 +365,16 @@ void cPrefab::AddConnector(int a_RelX, int a_RelY, int a_RelZ, eBlockFace a_Dire
+void cPrefab::SetAllowedRotations(int a_AllowedRotations)
+{
+ m_AllowedRotations = a_AllowedRotations;
+ AddRotatedBlockAreas();
+}
+
+
+
+
+
void cPrefab::ParseCharMap(CharMap & a_CharMapOut, const char * a_CharMapDef)
{
ASSERT(a_CharMapDef != nullptr);