summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-03-13 21:23:33 +0200
committerAndrei Karas <akaras@inbox.ru>2011-03-13 21:59:10 +0200
commitbf32ca896ccf51385eb67812088ba5861ca2ede2 (patch)
tree02cc6a7f8de3ef48b6092668368f3b5ba8f35683 /src/game.cpp
parent774e86e8d2f8d787fb3b3a865cd500f166153c96 (diff)
downloadplus-bf32ca896ccf51385eb67812088ba5861ca2ede2.tar.gz
plus-bf32ca896ccf51385eb67812088ba5861ca2ede2.tar.bz2
plus-bf32ca896ccf51385eb67812088ba5861ca2ede2.tar.xz
plus-bf32ca896ccf51385eb67812088ba5861ca2ede2.zip
Add ability to remap maps to different files.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp
index fe459f804..21758f66b 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -92,6 +92,7 @@
#include "net/playerhandler.h"
#include "resources/imagewriter.h"
+#include "resources/mapdb.h"
#include "resources/mapreader.h"
#include "resources/resourcemanager.h"
@@ -1386,12 +1387,15 @@ void Game::changeMap(const std::string &mapPath)
std::string fullMap = paths.getValue("maps", "maps/")
+ mMapName + ".tmx";
+ std::string realFullMap = paths.getValue("maps", "maps/")
+ + MapDB::getMapName(mMapName) + ".tmx";
+
ResourceManager *resman = ResourceManager::getInstance();
- if (!resman->exists(fullMap))
- fullMap += ".gz";
+ if (!resman->exists(realFullMap))
+ realFullMap += ".gz";
// Attempt to load the new map
- Map *newMap = MapReader::readMap(fullMap);
+ Map *newMap = MapReader::readMap(fullMap, realFullMap);
if (!newMap)
{