summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map.cpp31
-rw-r--r--src/map.h9
2 files changed, 28 insertions, 12 deletions
diff --git a/src/map.cpp b/src/map.cpp
index c810fab6..39b73091 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -25,14 +25,10 @@
#include "map.h"
#include "log.h"
#include "being.h"
-#include <queue>
-#include <stdio.h>
-#ifdef WIN32
-#include <windows.h>
-#else
-#include "./net/win2linux.h"
-#endif
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <queue>
Map tiledMap;
@@ -103,11 +99,12 @@ Map::~Map()
delete[] tiles;
}
-bool Map::load(char *mapFile) {
- FILE *file = fopen(mapFile, "r");
+bool Map::load(const std::string &mapFile)
+{
+ FILE *file = fopen(mapFile.c_str(), "r");
if (!file) {
- warning(mapFile);
+ warning(mapFile.c_str());
return false;
}
@@ -149,6 +146,20 @@ bool Map::load(char *mapFile) {
return true;
}
+bool loadXmlMap(const std::string &mapFile)
+{
+ xmlDocPtr doc = xmlReadFile(mapFile.c_str(), NULL, 0);
+
+ if (!doc) {
+ warning(mapFile.c_str());
+ return false;
+ }
+
+ xmlFreeDoc(doc);
+
+ return false;
+}
+
void Map::setSize(int width, int height)
{
this->width = width;
diff --git a/src/map.h b/src/map.h
index c8757603..26f3ef78 100644
--- a/src/map.h
+++ b/src/map.h
@@ -88,9 +88,14 @@ class Map
~Map();
/**
- * Loads a map file.
+ * Loads a map file (gat).
*/
- bool load(char *mapFile);
+ bool load(const std::string &mapFile);
+
+ /**
+ * Loads an XML map file (tmx).
+ */
+ bool loadXmlMap(const std::string &mapFile);
/**
* Sets the size of the map. This will destroy any existing map data.