summaryrefslogtreecommitdiffstats
path: root/src/Generating/ComposableGenerator.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-23 14:39:49 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-23 14:39:49 +0200
commit4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd (patch)
treecd86062eb50ba870f73b6f29dec0205f87205bf8 /src/Generating/ComposableGenerator.cpp
parentMerge branch 'master' into EntityCustomName (diff)
parentQtBiomeVisualiser: Fixed confusion about Globals.h. (diff)
downloadcuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.gz
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.bz2
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.lz
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.xz
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.tar.zst
cuberite-4b38e077cf8d27d1c7ef26d4148f7825c5aeaabd.zip
Diffstat (limited to 'src/Generating/ComposableGenerator.cpp')
-rw-r--r--src/Generating/ComposableGenerator.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index 6f4007d24..69068d231 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -230,17 +230,29 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
// Add a cache, if requested:
int CacheSize = a_IniFile.GetValueSetI("Generator", "BiomeGenCacheSize", CacheOffByDefault ? 0 : 64);
- if (CacheSize > 0)
+
+ if (CacheSize <= 0)
+ {
+ return;
+ }
+
+ int MultiCacheLength = a_IniFile.GetValueSetI("Generator", "BiomeGenMultiCacheLength", 4);
+ if (CacheSize < 4)
+ {
+ LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
+ CacheSize, 4
+ );
+ CacheSize = 4;
+ }
+ LOGD("Using a cache for biomegen of size %d.", CacheSize);
+ m_UnderlyingBiomeGen = m_BiomeGen;
+ if (MultiCacheLength > 0)
+ {
+ LOGD("Enabling multicache for biomegen of length %d.", MultiCacheLength);
+ m_BiomeGen = new cBioGenMulticache(m_UnderlyingBiomeGen, CacheSize, MultiCacheLength);
+ }
+ else
{
- if (CacheSize < 4)
- {
- LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
- CacheSize, 4
- );
- CacheSize = 4;
- }
- LOGD("Using a cache for biomegen of size %d.", CacheSize);
- m_UnderlyingBiomeGen = m_BiomeGen;
m_BiomeGen = new cBioGenCache(m_UnderlyingBiomeGen, CacheSize);
}
}