summaryrefslogtreecommitdiffstats
path: root/src/BlockArea.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-06-30 14:08:21 +0200
committerMattes D <github@xoft.cz>2015-06-30 14:08:21 +0200
commitf6ab4613836dd031c2d118fc1e566fdc76814082 (patch)
treea9d434cc6f4837495858d5fc39d2683f2569152a /src/BlockArea.cpp
parentFixed typos in the readme. (diff)
downloadcuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.tar
cuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.tar.gz
cuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.tar.bz2
cuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.tar.lz
cuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.tar.xz
cuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.tar.zst
cuberite-f6ab4613836dd031c2d118fc1e566fdc76814082.zip
Diffstat (limited to '')
-rw-r--r--src/BlockArea.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/BlockArea.cpp b/src/BlockArea.cpp
index 938351207..eb25d624d 100644
--- a/src/BlockArea.cpp
+++ b/src/BlockArea.cpp
@@ -336,6 +336,12 @@ void cBlockArea::Create(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
);
return;
}
+
+ // Warn if the height is too much, but proceed with the creation:
+ if (a_SizeY > cChunkDef::Height)
+ {
+ LOGWARNING("Creating a cBlockArea with height larger than world height (%d). Continuing, but the area may misbehave.", a_SizeY);
+ }
Clear();
int BlockCount = a_SizeX * a_SizeY * a_SizeZ;
@@ -540,7 +546,7 @@ bool cBlockArea::Write(cForEachChunkProvider * a_ForEachChunkProvider, int a_Min
else if (a_MinBlockY > cChunkDef::Height - m_Size.y)
{
LOGWARNING("%s: MinBlockY + m_SizeY more than chunk height, adjusting to chunk height", __FUNCTION__);
- a_MinBlockY = cChunkDef::Height - m_Size.y;
+ a_MinBlockY = std::max(cChunkDef::Height - m_Size.y, 0);
}
return a_ForEachChunkProvider->WriteBlockArea(*this, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes);