summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-20 10:23:30 +0200
committermadmaxoft <github@xoft.cz>2013-10-20 10:23:30 +0200
commit34928378b8e3464326de38787bfada9adc0bfb11 (patch)
treef057fec656fcead894b49315b948c078c2ba07d7 /source/World.cpp
parentMerge branch 'htmlescape'. (diff)
downloadcuberite-34928378b8e3464326de38787bfada9adc0bfb11.tar
cuberite-34928378b8e3464326de38787bfada9adc0bfb11.tar.gz
cuberite-34928378b8e3464326de38787bfada9adc0bfb11.tar.bz2
cuberite-34928378b8e3464326de38787bfada9adc0bfb11.tar.lz
cuberite-34928378b8e3464326de38787bfada9adc0bfb11.tar.xz
cuberite-34928378b8e3464326de38787bfada9adc0bfb11.tar.zst
cuberite-34928378b8e3464326de38787bfada9adc0bfb11.zip
Diffstat (limited to 'source/World.cpp')
-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: