From 07097534a379ba057ef754eb9198e7d33f961b5a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Tue, 20 Nov 2012 19:45:28 +0000 Subject: Biome lists can have ":count" in them for adjusting biome occurence rate. Some more error logging. Idea created at FS #274, http://www.mc-server.org/support/index.php?do=details&task_id=274 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1054 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/BioGen.cpp | 26 ++++++++++++++++++++++++-- source/Generating/BioGen.h | 1 + 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'source/Generating') 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); } ; -- cgit v1.2.3