summaryrefslogtreecommitdiffstats
path: root/src/Generating/GridStructGen.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-25 00:21:39 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-05-25 00:21:39 +0200
commitf55f5ec47f67dcc31e56bc364297aaf60d75b0c3 (patch)
tree62262220c9342b0eab368f553a836d736a39d972 /src/Generating/GridStructGen.cpp
parentUpdate CompositeChat.h (diff)
parentUpdate README.md (diff)
downloadcuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.tar
cuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.tar.gz
cuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.tar.bz2
cuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.tar.lz
cuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.tar.xz
cuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.tar.zst
cuberite-f55f5ec47f67dcc31e56bc364297aaf60d75b0c3.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
+ );
+ }
}