diff options
-rw-r--r-- | source/Generating/BioGen.cpp | 26 | ||||
-rw-r--r-- | source/Generating/BioGen.h | 1 |
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); } ; |