summaryrefslogtreecommitdiffstats
path: root/source/cChunkGenerator.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-02 15:21:59 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-02 15:21:59 +0200
commit5e831256ef838e0238a6fd5eaf3b3e39791c6d77 (patch)
treeb525331223279e19a4916a4b0295f3fb618e3b2d /source/cChunkGenerator.cpp
parentAdded the Biomal height generator, made it the default height generator. (diff)
downloadcuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.tar
cuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.tar.gz
cuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.tar.bz2
cuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.tar.lz
cuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.tar.xz
cuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.tar.zst
cuberite-5e831256ef838e0238a6fd5eaf3b3e39791c6d77.zip
Diffstat (limited to '')
-rw-r--r--source/cChunkGenerator.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/cChunkGenerator.cpp b/source/cChunkGenerator.cpp
index 5aa50c20a..1687e0e13 100644
--- a/source/cChunkGenerator.cpp
+++ b/source/cChunkGenerator.cpp
@@ -111,6 +111,7 @@ void cChunkGenerator::InitBiomeGen(cIniFile & a_IniFile)
BiomeGenName = "constant";
}
+ bool CacheOffByDefault = false;
if (NoCaseCompare(BiomeGenName, "constant") == 0)
{
AString Biome = a_IniFile.GetValue("Generator", "ConstantBiome", "Plains");
@@ -121,12 +122,14 @@ void cChunkGenerator::InitBiomeGen(cIniFile & a_IniFile)
b = biPlains;
}
m_BiomeGen = new cBioGenConstant(b);
+ CacheOffByDefault = true; // we're generating faster than a cache would retrieve data :)
}
else if (NoCaseCompare(BiomeGenName, "checkerboard") == 0)
{
int BiomeSize = a_IniFile.GetValueI("Generator", "CheckerboardBiomeSize", 64);
AString Biomes = a_IniFile.GetValue("Generator", "CheckerBoardBiomes", "");
m_BiomeGen = new cBioGenCheckerboard(BiomeSize, Biomes);
+ CacheOffByDefault = true; // we're (probably) generating faster than a cache would retrieve data
}
else if (NoCaseCompare(BiomeGenName, "voronoi") == 0)
{
@@ -144,6 +147,21 @@ void cChunkGenerator::InitBiomeGen(cIniFile & a_IniFile)
AString Biomes = a_IniFile.GetValue("Generator", "DistortedVoronoiBiomes", "");
m_BiomeGen = new cBioGenDistortedVoronoi(m_Seed, CellSize, Biomes);
}
+
+ // Add a cache, if requested:
+ int CacheSize = a_IniFile.GetValueI("Generator", "BiomeGenCacheSize", CacheOffByDefault ? 0 : 64);
+ if (CacheSize > 0)
+ {
+ 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;
+ }
+ LOGINFO("Using a cache for biomegen of size %d.", CacheSize);
+ m_BiomeGen = new cBioGenCache(m_BiomeGen, CacheSize);
+ }
}