diff options
author | worktycho <work.tycho@gmail.com> | 2015-06-19 20:41:28 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-06-19 20:41:28 +0200 |
commit | 33d68572a61fa1c2201278b8bf4f77c73371930e (patch) | |
tree | 44a986bb7f90beee57a5bdc842c720fd657618bb /src/Generating/Prefab.cpp | |
parent | Check the return value of InflateString (diff) | |
parent | Added cubeset file format docs. (diff) | |
download | cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.tar cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.tar.gz cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.tar.bz2 cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.tar.lz cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.tar.xz cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.tar.zst cuberite-33d68572a61fa1c2201278b8bf4f77c73371930e.zip |
Diffstat (limited to 'src/Generating/Prefab.cpp')
-rw-r--r-- | src/Generating/Prefab.cpp | 49 |
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); |