summaryrefslogtreecommitdiffstats
path: root/src/Generating/GridStructGen.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2014-06-26 20:04:56 +0200
committerworktycho <work.tycho@gmail.com>2014-06-26 20:04:56 +0200
commit25a0264cc46d97f52bd836280fa5d2908846ac02 (patch)
treefbed8cedc542d1dd57e3e407c3a8b8d3097dbafe /src/Generating/GridStructGen.cpp
parentAdd Null check to SendBlockTo (diff)
downloadcuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.tar
cuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.tar.gz
cuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.tar.bz2
cuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.tar.lz
cuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.tar.xz
cuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.tar.zst
cuberite-25a0264cc46d97f52bd836280fa5d2908846ac02.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/GridStructGen.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 95f8c38bc..a3578de6f 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -53,6 +53,16 @@ cGridStructGen::cGridStructGen(
m_MaxStructureSizeZ(a_MaxStructureSizeZ),
m_MaxCacheSize(a_MaxCacheSize)
{
+ if (m_GridSizeX == 0)
+ {
+ LOG("Grid Size cannot be zero, setting to 1");
+ m_GridSizeX = 1;
+ }
+ if (m_GridSizeZ == 0)
+ {
+ LOG("Grid Size cannot be zero, setting to 1");
+ m_GridSizeZ = 1;
+ }
size_t NumStructuresPerQuery = (size_t)(((m_MaxStructureSizeX + m_MaxOffsetX) / m_GridSizeX + 1) * ((m_MaxStructureSizeZ + m_MaxOffsetZ) / m_GridSizeZ + 1));
if (NumStructuresPerQuery > m_MaxCacheSize)
{