From bf32ca896ccf51385eb67812088ba5861ca2ede2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 Mar 2011 21:23:33 +0200 Subject: Add ability to remap maps to different files. --- src/game.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/game.cpp') 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) { -- cgit v1.2.3-60-g2f50