summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-09-03 23:02:00 +0200
committermadmaxoft <github@xoft.cz>2014-09-03 23:02:00 +0200
commitbae928fd27cb26ec55db04f64d8de888443d65a0 (patch)
tree095d8e7437ef4c2ce65fa60abbe2b643e33528a0 /src
parentAdded cIniFile::HasValue() function. (diff)
downloadcuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.tar
cuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.tar.gz
cuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.tar.bz2
cuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.tar.lz
cuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.tar.xz
cuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.tar.zst
cuberite-bae928fd27cb26ec55db04f64d8de888443d65a0.zip
Diffstat (limited to 'src')
-rw-r--r--src/Generating/ChunkGenerator.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Generating/ChunkGenerator.cpp b/src/Generating/ChunkGenerator.cpp
index d39b44733..4fa9729ec 100644
--- a/src/Generating/ChunkGenerator.cpp
+++ b/src/Generating/ChunkGenerator.cpp
@@ -52,10 +52,21 @@ bool cChunkGenerator::Start(cPluginInterface & a_PluginInterface, cChunkSink & a
m_PluginInterface = &a_PluginInterface;
m_ChunkSink = &a_ChunkSink;
- MTRand rnd;
- m_Seed = a_IniFile.GetValueSetI("Seed", "Seed", (int)rnd.randInt());
+ // Get the seed; create a new one and log it if not found in the INI file:
+ if (a_IniFile.HasValue("Seed", "Seed"))
+ {
+ m_Seed = a_IniFile.GetValueI("Seed", "Seed");
+ }
+ else
+ {
+ MTRand rnd;
+ m_Seed = rnd.randInt();
+ LOGINFO("Chosen a new random seed for world: %d", m_Seed);
+ a_IniFile.SetValueI("Seed", "Seed", m_Seed);
+ }
+
+ // Get the generator engine based on the INI file settings:
AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable");
-
if (NoCaseCompare(GeneratorName, "Noise3D") == 0)
{
m_Generator = new cNoise3DGenerator(*this);