diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-08-27 20:47:31 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2007-08-27 20:47:31 +0000 |
commit | 76291862ce0e26040f251bc4764539d8ff6634a0 (patch) | |
tree | 6d89b1816081da7338e8571be7165ffe8138cfb6 /src/engine.cpp | |
parent | ce0ccc904a899e3aa8e719d2407391433b3b4be5 (diff) | |
download | mana-76291862ce0e26040f251bc4764539d8ff6634a0.tar.gz mana-76291862ce0e26040f251bc4764539d8ff6634a0.tar.bz2 mana-76291862ce0e26040f251bc4764539d8ff6634a0.tar.xz mana-76291862ce0e26040f251bc4764539d8ff6634a0.zip |
Made client search for both compressed and non-compressed map files.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index fb6b6048..4a0f2f1f 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -72,7 +72,16 @@ void Engine::changeMap(const std::string &mapPath) particleEngine->clear(); // Store full map path in global var - map_path = "maps/" + mapPath.substr(0, mapPath.rfind(".")) + ".tmx.gz"; + const std::string base = "maps/" + mapPath.substr(0, mapPath.rfind(".")); + ResourceManager *resman = ResourceManager::getInstance(); + if (resman->exists(base + ".tmx")) + { + map_path = base + ".tmx"; + } + else + { + map_path = base + ".tmx.gz"; + } // Attempt to load the new map Map *newMap = MapReader::readMap(map_path); @@ -85,7 +94,6 @@ void Engine::changeMap(const std::string &mapPath) Image *mapImage = NULL; if (newMap->hasProperty("minimap")) { - ResourceManager *resman = ResourceManager::getInstance(); mapImage = resman->getImage(newMap->getProperty("minimap")); } minimap->setMapImage(mapImage); |