summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-20 20:45:28 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-11-20 20:45:28 +0100
commit07097534a379ba057ef754eb9198e7d33f961b5a (patch)
tree000e463e899991be64a72c4a25c6d5e9aa3c9917
parentFixed wrong c++ standard assumptions about bools. (diff)
downloadcuberite-07097534a379ba057ef754eb9198e7d33f961b5a.tar
cuberite-07097534a379ba057ef754eb9198e7d33f961b5a.tar.gz
cuberite-07097534a379ba057ef754eb9198e7d33f961b5a.tar.bz2
cuberite-07097534a379ba057ef754eb9198e7d33f961b5a.tar.lz
cuberite-07097534a379ba057ef754eb9198e7d33f961b5a.tar.xz
cuberite-07097534a379ba057ef754eb9198e7d33f961b5a.tar.zst
cuberite-07097534a379ba057ef754eb9198e7d33f961b5a.zip
-rw-r--r--source/Generating/BioGen.cpp26
-rw-r--r--source/Generating/BioGen.h1
2 files changed, 25 insertions, 2 deletions
diff --git a/source/Generating/BioGen.cpp b/source/Generating/BioGen.cpp
index d12bdcf52..eecb63c27 100644
--- a/source/Generating/BioGen.cpp
+++ b/source/Generating/BioGen.cpp
@@ -125,10 +125,32 @@ void cBiomeGenList::InitializeBiomes(const AString & a_Biomes)
// Convert each string in the list into biome:
for (AStringVector::const_iterator itr = Split.begin(); itr != Split.end(); ++itr)
{
- EMCSBiome Biome = StringToBiome(*itr);
+ AStringVector Split2 = StringSplit(*itr, ":");
+ if (Split2.size() < 1)
+ {
+ continue;
+ }
+ int Count = 1;
+ if (Split2.size() >= 2)
+ {
+ Count = atol(Split2[1].c_str());
+ if (Count <= 0)
+ {
+ LOGWARNING("Cannot decode biome count: \"%s\"; using 1.", Split2[1].c_str());
+ Count = 1;
+ }
+ }
+ EMCSBiome Biome = StringToBiome(Split2[0]);
if (Biome != -1)
{
- m_Biomes.push_back(Biome);
+ for (int i = 0; i < Count; i++)
+ {
+ m_Biomes.push_back(Biome);
+ }
+ }
+ else
+ {
+ LOGWARNING("Cannot decode biome name: \"%s\"; skipping", Split2[0].c_str());
}
} // for itr - Split[]
if (!m_Biomes.empty())
diff --git a/source/Generating/BioGen.h b/source/Generating/BioGen.h
index d268c1de6..6faca09c1 100644
--- a/source/Generating/BioGen.h
+++ b/source/Generating/BioGen.h
@@ -90,6 +90,7 @@ protected:
EMCSBiomes m_Biomes;
int m_BiomesCount; // Pulled out of m_Biomes for faster access
+ /// Parses the INI file setting string into m_Biomes.
void InitializeBiomes(const AString & a_Biomes);
} ;