summaryrefslogtreecommitdiffstats
path: root/src/Generating/Prefab.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-15 00:12:01 +0200
committermadmaxoft <github@xoft.cz>2014-05-15 00:12:01 +0200
commit3660ce68343ad2e867e49d1650f61fc0eb85ac23 (patch)
tree33d0c7b9994104f1eea432a91b53c35564afb3c5 /src/Generating/Prefab.cpp
parentVillageGen: Added well placement and the general algorithm description. (diff)
downloadcuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.tar
cuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.tar.gz
cuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.tar.bz2
cuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.tar.lz
cuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.tar.xz
cuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.tar.zst
cuberite-3660ce68343ad2e867e49d1650f61fc0eb85ac23.zip
Diffstat (limited to 'src/Generating/Prefab.cpp')
-rw-r--r--src/Generating/Prefab.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index 0f20603be..9aef7a94b 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -136,6 +136,33 @@ cPrefab::cPrefab(const cPrefab::sDef & a_Def) :
ParseConnectors(a_Def.m_Connectors);
ParseDepthWeight(a_Def.m_DepthWeight);
+ AddRotatedBlockAreas();
+}
+
+
+
+
+
+cPrefab::cPrefab(const cBlockArea & a_Image, int a_AllowedRotations) :
+ m_Size(a_Image.GetSize()),
+ m_AllowedRotations(a_AllowedRotations),
+ m_MergeStrategy(cBlockArea::msOverwrite),
+ m_ShouldExtendFloor(false),
+ m_DefaultWeight(1),
+ m_AddWeightIfSame(0)
+{
+ 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);
+ AddRotatedBlockAreas();
+}
+
+
+
+
+
+void cPrefab::AddRotatedBlockAreas(void)
+{
// 1 CCW rotation:
if ((m_AllowedRotations & 0x01) != 0)
{
@@ -257,6 +284,15 @@ int cPrefab::GetPieceWeight(const cPlacedPiece & a_PlacedPiece, const cPiece::cC
+void cPrefab::AddConnector(int a_RelX, int a_RelY, int a_RelZ, eBlockFace a_Direction, int a_Type)
+{
+ m_Connectors.push_back(cConnector(a_RelX, a_RelY, a_RelZ, a_Type, a_Direction));
+}
+
+
+
+
+
void cPrefab::ParseCharMap(CharMap & a_CharMapOut, const char * a_CharMapDef)
{
ASSERT(a_CharMapDef != NULL);