summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/World.cpp39
1 files changed, 28 insertions, 11 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 039e192d9..bcf32df85 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -489,19 +489,36 @@ void cWorld::Start(void)
m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode);
+ // Load allowed mobs:
+ const char * DefaultMonsters = "";
+ switch (m_Dimension)
+ {
+ case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break;
+ case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break;
+ case dimEnd: DefaultMonsters = "enderman"; break;
+ default:
+ {
+ ASSERT(!"Unhandled world dimension");
+ DefaultMonsters = "wither";
+ break;
+ }
+ }
m_bAnimals = IniFile.GetValueB("Monsters", "AnimalsOn", true);
- AString sAllMonsters = IniFile.GetValue("Monsters", "Types");
- AStringVector SplitList = StringSplit(sAllMonsters, ",");
- for (unsigned int i = 0; i < SplitList.size(); ++i)
+ AString AllMonsters = IniFile.GetValueSet("Monsters", "Types", DefaultMonsters);
+ AStringVector SplitList = StringSplitAndTrim(AllMonsters, ",");
+ for (AStringVector::const_iterator itr = SplitList.begin(), end = SplitList.end(); itr != end; ++itr)
{
- cMonster::eType ToAdd = cMobTypesManager::fromStringToMobType(SplitList[i]);
+ cMonster::eType ToAdd = cMobTypesManager::StringToMobType(*itr);
if (ToAdd != cMonster::mtInvalidType)
{
m_AllowedMobs.insert(ToAdd);
- LOGD("Allowed mob: %s",cMobTypesManager::fromMobTypeToString(ToAdd).c_str()); // a bit reverse working, but very few ressources wasted
+ LOGD("Allowed mob: %s", cMobTypesManager::MobTypeToString(ToAdd).c_str()); // a bit reverse working, but very few ressources wasted
}
- };
-
+ else
+ {
+ LOG("World \"%s\": Unknown mob type: %s", m_WorldName.c_str(), itr->c_str());
+ }
+ }
m_ChunkMap = new cChunkMap(this);
@@ -532,10 +549,10 @@ void cWorld::Start(void)
m_TickThread.Start();
// Init of the spawn monster time (as they are supposed to have different spawn rate)
- m_LastSpawnMonster.insert(std::map<cMonster::eFamily,Int64>::value_type(cMonster::mfHostile,0));
- m_LastSpawnMonster.insert(std::map<cMonster::eFamily,Int64>::value_type(cMonster::mfPassive,0));
- m_LastSpawnMonster.insert(std::map<cMonster::eFamily,Int64>::value_type(cMonster::mfAmbient,0));
- m_LastSpawnMonster.insert(std::map<cMonster::eFamily,Int64>::value_type(cMonster::mfWater,0));
+ m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfHostile, 0));
+ m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfPassive, 0));
+ m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfAmbient, 0));
+ m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfWater, 0));
// Save any changes that the defaults may have done to the ini file: