summaryrefslogtreecommitdiffstats
path: root/src/Generating/GridStructGen.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-15 09:01:32 +0200
committermadmaxoft <github@xoft.cz>2014-07-15 09:01:32 +0200
commit8e946da8ac109a8bedf9d243251f9a18d29e5a1a (patch)
tree30f046ddec20d809e3fa84e78b76f31915a361c2 /src/Generating/GridStructGen.cpp
parentItemHandler.cpp: removed redundant food and drink checks (diff)
parentPass cItem by reference. (diff)
downloadcuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.tar
cuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.tar.gz
cuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.tar.bz2
cuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.tar.lz
cuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.tar.xz
cuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.tar.zst
cuberite-8e946da8ac109a8bedf9d243251f9a18d29e5a1a.zip
Diffstat (limited to 'src/Generating/GridStructGen.cpp')
-rw-r--r--src/Generating/GridStructGen.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 95f8c38bc..fd1d5e49f 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -44,6 +44,7 @@ cGridStructGen::cGridStructGen(
int a_MaxStructureSizeX, int a_MaxStructureSizeZ,
size_t a_MaxCacheSize
) :
+ m_Seed(a_Seed),
m_Noise(a_Seed),
m_GridSizeX(a_GridSizeX),
m_GridSizeZ(a_GridSizeZ),
@@ -53,6 +54,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)
{