diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-10-18 00:13:34 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2011-10-19 22:32:28 +0200 |
commit | c8f2916bdc60f7c5b632655cfe9bddaad3a15bc0 (patch) | |
tree | a3a867fae425ca3e53d166748f315a22d6eda28d /src/game-server/mapmanager.cpp | |
parent | 210e33c8b32f3bbc696e5ffd1affef65a7d66b5d (diff) | |
download | manaserv-c8f2916bdc60f7c5b632655cfe9bddaad3a15bc0.tar.gz manaserv-c8f2916bdc60f7c5b632655cfe9bddaad3a15bc0.tar.bz2 manaserv-c8f2916bdc60f7c5b632655cfe9bddaad3a15bc0.tar.xz manaserv-c8f2916bdc60f7c5b632655cfe9bddaad3a15bc0.zip |
Took interpreting the objects out of the map reader
The map reader is now only concerned with parsing the XML, whereas the
MapComposite turns some of the objects into Warps, Spawns and NPCs.
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/game-server/mapmanager.cpp')
-rw-r--r-- | src/game-server/mapmanager.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp index 094af923..4d7b25b4 100644 --- a/src/game-server/mapmanager.cpp +++ b/src/game-server/mapmanager.cpp @@ -1,6 +1,7 @@ /* * The Mana Server * Copyright (C) 2004-2010 The Mana World Development Team + * Copyright (C) 2010-2011 The Mana Development Team * * This file is part of The Mana Server. * @@ -23,7 +24,6 @@ #include "common/resourcemanager.h" #include "game-server/map.h" #include "game-server/mapcomposite.h" -#include "game-server/mapreader.h" #include "utils/logger.h" #include "utils/xml.h" @@ -127,30 +127,25 @@ MapComposite *MapManager::getMap(const std::string &mapName) return NULL; } -bool MapManager::raiseActive(int mapId) +bool MapManager::activateMap(int mapId) { Maps::iterator i = maps.find(mapId); assert(i != maps.end()); MapComposite *composite = i->second; + if (composite->isActive()) - { return true; - } - std::string file = "maps/" + composite->getName() + ".tmx"; - if (!ResourceManager::exists(file)) - { - file += ".gz"; - } - if (MapReader::readMap(file, composite)) + if (composite->activate()) { - LOG_INFO("Activated map \"" << file << "\" (id " << mapId << ")"); + LOG_INFO("Activated map \"" << composite->getName() + << "\" (id " << mapId << ")"); return true; } else { - LOG_WARN("Couldn't activate invalid map \"" << file << "\" (id " << - mapId << ")"); + LOG_WARN("Couldn't activate invalid map \"" << composite->getName() + << "\" (id " << mapId << ")"); return false; } } |