summaryrefslogtreecommitdiffstats
path: root/source/BlockArea.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-25 13:16:23 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-03-25 13:16:23 +0100
commite0707a7af6238dabe2554f14a188cf1ca993e778 (patch)
tree89b108e27c3696c3e4c34323d4aa3ab95c6bc74f /source/BlockArea.cpp
parentFixed underflow issue in LeakFinder.cpp (diff)
downloadcuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.tar
cuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.tar.gz
cuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.tar.bz2
cuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.tar.lz
cuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.tar.xz
cuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.tar.zst
cuberite-e0707a7af6238dabe2554f14a188cf1ca993e778.zip
Diffstat (limited to 'source/BlockArea.cpp')
-rw-r--r--source/BlockArea.cpp182
1 files changed, 182 insertions, 0 deletions
diff --git a/source/BlockArea.cpp b/source/BlockArea.cpp
index 61abae716..229098967 100644
--- a/source/BlockArea.cpp
+++ b/source/BlockArea.cpp
@@ -919,6 +919,187 @@ void cBlockArea::RelLine(int a_RelX1, int a_RelY1, int a_RelZ1, int a_RelX2, int
+void cBlockArea::RotateCW(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::RotateCCW(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::MirrorXY(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::MirrorXZ(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::MirrorYZ(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::RotateCWNoMeta(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::RotateCCWNoMeta(void)
+{
+ ASSERT(!"Not implemented yet");
+ // TODO
+}
+
+
+
+
+
+void cBlockArea::MirrorXYNoMeta(void)
+{
+ int HalfZ = m_SizeZ / 2;
+ int MaxZ = m_SizeZ - 1;
+ if (HasBlockTypes())
+ {
+ for (int y = 0; y < m_SizeY; y++)
+ {
+ for (int z = 0; z < HalfZ; z++)
+ {
+ for (int x = 0; x < m_SizeX; x++)
+ {
+ std::swap(m_BlockTypes[MakeIndex(x, y, z)], m_BlockTypes[MakeIndex(x, y, MaxZ - z)]);
+ } // for x
+ } // for z
+ } // for y
+ } // if (HasBlockTypes)
+
+ if (HasBlockMetas())
+ {
+ for (int y = 0; y < m_SizeY; y++)
+ {
+ for (int z = 0; z < HalfZ; z++)
+ {
+ for (int x = 0; x < m_SizeX; x++)
+ {
+ std::swap(m_BlockMetas[MakeIndex(x, y, z)], m_BlockMetas[MakeIndex(x, y, MaxZ - z)]);
+ } // for x
+ } // for z
+ } // for y
+ } // if (HasBlockTypes)
+}
+
+
+
+
+
+void cBlockArea::MirrorXZNoMeta(void)
+{
+ int HalfY = m_SizeY / 2;
+ int MaxY = m_SizeY - 1;
+ if (HasBlockTypes())
+ {
+ for (int y = 0; y < HalfY; y++)
+ {
+ for (int z = 0; z < m_SizeZ; z++)
+ {
+ for (int x = 0; x < m_SizeX; x++)
+ {
+ std::swap(m_BlockTypes[MakeIndex(x, y, z)], m_BlockTypes[MakeIndex(x, MaxY - y, z)]);
+ } // for x
+ } // for z
+ } // for y
+ } // if (HasBlockTypes)
+
+ if (HasBlockMetas())
+ {
+ for (int y = 0; y < HalfY; y++)
+ {
+ for (int z = 0; z < m_SizeZ; z++)
+ {
+ for (int x = 0; x < m_SizeX; x++)
+ {
+ std::swap(m_BlockMetas[MakeIndex(x, y, z)], m_BlockMetas[MakeIndex(x, MaxY - y, z)]);
+ } // for x
+ } // for z
+ } // for y
+ } // if (HasBlockTypes)
+}
+
+
+
+
+
+void cBlockArea::MirrorYZNoMeta(void)
+{
+ int HalfX = m_SizeX / 2;
+ int MaxX = m_SizeX - 1;
+ if (HasBlockTypes())
+ {
+ for (int y = 0; y < m_SizeY; y++)
+ {
+ for (int z = 0; z < m_SizeZ; z++)
+ {
+ for (int x = 0; x < HalfX; x++)
+ {
+ std::swap(m_BlockTypes[MakeIndex(x, y, z)], m_BlockTypes[MakeIndex(MaxX - x, y, z)]);
+ } // for x
+ } // for z
+ } // for y
+ } // if (HasBlockTypes)
+
+ if (HasBlockMetas())
+ {
+ for (int y = 0; y < m_SizeY; y++)
+ {
+ for (int z = 0; z < m_SizeZ; z++)
+ {
+ for (int x = 0; x < HalfX; x++)
+ {
+ std::swap(m_BlockMetas[MakeIndex(x, y, z)], m_BlockMetas[MakeIndex(MaxX - x, y, z)]);
+ } // for x
+ } // for z
+ } // for y
+ } // if (HasBlockTypes)
+}
+
+
+
+
+
void cBlockArea::SetRelBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
{
if (m_BlockTypes == NULL)
@@ -1642,6 +1823,7 @@ bool cBlockArea::LoadFromSchematicNBT(cParsedNBT & a_NBT)
}
bool AreMetasPresent = (TBlockMetas > 0) && (a_NBT.GetType(TBlockMetas) == TAG_ByteArray);
+ Clear();
SetSize(SizeX, SizeY, SizeZ, AreMetasPresent ? (baTypes | baMetas) : baTypes);
// Copy the block types and metas: