summaryrefslogtreecommitdiffstats
path: root/src/Generating/GridStructGen.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-23 14:00:41 +0200
committerMattes D <github@xoft.cz>2014-05-23 14:00:41 +0200
commit4f2db0385138d8a97b76910f6373c298dfc1ed8f (patch)
tree328364d646f9650d2290d66fe6ce09cbb9af9eb8 /src/Generating/GridStructGen.cpp
parentFixed datatype conversion warning. (diff)
parentFixed Mineshaft system size. (diff)
downloadcuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.tar
cuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.tar.gz
cuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.tar.bz2
cuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.tar.lz
cuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.tar.xz
cuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.tar.zst
cuberite-4f2db0385138d8a97b76910f6373c298dfc1ed8f.zip
Diffstat (limited to 'src/Generating/GridStructGen.cpp')
-rw-r--r--src/Generating/GridStructGen.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 3bbc89054..bfa6bccb1 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -22,6 +22,15 @@ cGridStructGen::cGridStructGen(
m_MaxStructureSizeZ(a_MaxStructureSizeZ),
m_MaxCacheSize(a_MaxCacheSize)
{
+ size_t NumStructuresPerQuery = (size_t)((m_MaxStructureSizeX / m_GridSizeX + 1) * (m_MaxStructureSizeZ / m_GridSizeZ + 1));
+ if (NumStructuresPerQuery > m_MaxCacheSize)
+ {
+ m_MaxCacheSize = NumStructuresPerQuery * 4;
+ LOGINFO(
+ "cGridStructGen: The cache size is too small (%u), increasing the cache size to %u to avoid inefficiency.",
+ (unsigned)a_MaxCacheSize, (unsigned)m_MaxCacheSize
+ );
+ }
}