summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-20 19:32:32 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-03-20 19:32:32 +0000
commitc93f9d8acd4b01b41afe095bc8391ef498c55eba (patch)
tree2e580486ad1cb6077478964f6a81ca9c8ea9628b /src
parent90e5ce7e958418f0d39d38112d33d3190a78baea (diff)
downloadmana-c93f9d8acd4b01b41afe095bc8391ef498c55eba.tar.gz
mana-c93f9d8acd4b01b41afe095bc8391ef498c55eba.tar.bz2
mana-c93f9d8acd4b01b41afe095bc8391ef498c55eba.tar.xz
mana-c93f9d8acd4b01b41afe095bc8391ef498c55eba.zip
Auto-detect map files in new map format.
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp2
-rw-r--r--src/map.cpp6
2 files changed, 6 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index e7eebbe6..d7dd7c80 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -36,7 +36,6 @@
#include "gui/npc.h"
#include "gui/stats.h"
#include "gui/ok_dialog.h"
-#include "resources/mapreader.h"
#include "net/protocol.h"
#include <SDL.h>
#include <sstream>
@@ -127,7 +126,6 @@ void game() {
void do_init()
{
tiledMap = Map::load(map_path);
- //tiledMap = MapReader::readMap("core/maps/tempdesert.tmx.gz");
if (!tiledMap) {
error("Could not find map file");
}
diff --git a/src/map.cpp b/src/map.cpp
index 9419233d..e7323b58 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -112,6 +112,12 @@ Map::~Map()
Map *Map::load(const std::string &mapFile)
{
+ if (mapFile.find(".tmx", 0) != std::string::npos)
+ {
+ // New map file format assumed
+ return MapReader::readMap(mapFile);
+ }
+
FILE *file = fopen(mapFile.c_str(), "r");
if (!file) {