summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-13 15:40:44 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-13 15:40:44 +0000
commitb092468063d314d96aee6624cdb1a8fa78599424 (patch)
treeec09bb99d4cf52cbd8f68f17ef4fd3d478f62ea9 /src/map.cpp
parent4b2a028c8002609bd9256d1f8fd73aceee5c44fc (diff)
downloadmana-b092468063d314d96aee6624cdb1a8fa78599424.tar.gz
mana-b092468063d314d96aee6624cdb1a8fa78599424.tar.bz2
mana-b092468063d314d96aee6624cdb1a8fa78599424.tar.xz
mana-b092468063d314d96aee6624cdb1a8fa78599424.zip
Small start on XML map loading. Windows users pay attention to instructions
in win32.txt.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp31
1 files changed, 21 insertions, 10 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;