summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--The Mana World.dev2
-rw-r--r--docs/INSTALL/win32.txt17
-rw-r--r--src/map.cpp31
-rw-r--r--src/map.h9
-rw-r--r--tmw.ini2
5 files changed, 47 insertions, 14 deletions
diff --git a/The Mana World.dev b/The Mana World.dev
index 56c8203c..440358c5 100644
--- a/The Mana World.dev
+++ b/The Mana World.dev
@@ -12,7 +12,7 @@ ResourceIncludes=
MakeIncludes=
Compiler=-Dmain=SDL_main_@@_
CppCompiler=-funroll-loops_@@_-ffast-math_@@_-fomit-frame-pointer_@@_-pipe_@@_
-Linker=-lguichan_@@_-lguichan_sdl_@@_-lwsock32_@@_-lSDL_image_@@_-lSDL_mixer_@@_-lmingw32_@@_-lSDLmain_@@_-lSDL_@@_
+Linker=-lguichan_@@_-lguichan_sdl_@@_-lwsock32_@@_-lSDL_image_@@_-lSDL_mixer_@@_-lmingw32_@@_-lSDLmain_@@_-lSDL_@@_-llibxml2_@@_
IsCpp=1
Icon=The Mana World.ico
ExeOutput=
diff --git a/docs/INSTALL/win32.txt b/docs/INSTALL/win32.txt
index 639db596..73d24ff3 100644
--- a/docs/INSTALL/win32.txt
+++ b/docs/INSTALL/win32.txt
@@ -29,6 +29,7 @@ Besides a C++ compiler, TMW depends on the following libraries:
2) SDL_mixer
3) SDL_image
4) Guichan 0.2.0
+5) libxml2
2. Installing Dev-C++
@@ -55,11 +56,21 @@ Get the following list of DevPaks:
- SDL_mixer (http://devpaks.org/show.php?devpak=26)
- SDL_image (http://devpaks.org/show.php?devpak=25)
- Guichan (http://guichan.darkbits.org/downloads/guichan-0.2.0.DevPak)
+- libxml2 ** (ftp://ftp.zlatkovic.com/pub/libxml/)
Install them all through the Dev-C++ package manager. For SDL_image you may
still need to manually get the SDL_image.lib file from the SDL_image homepage
(devel VC6 zip file) and copy it to your Dev-Cpp/lib directory.
+**) For libxml2, download the following files (these or newer versions):
+
+ libxml2-2.6.17.win32.zip
+ iconv-1.9.1.win32.zip
+ zlib-1.2.1.win32.zip
+
+ From each file, copy the headers to your include directory, the libs to
+ the lib direcotry and the dlls (in bin direcotry) to your tmw directory.
+
You should now be fully equipped for compiling the latest TMW CVS code!
@@ -88,5 +99,11 @@ DLLs from your Dev-Cpp/dll directory to the directory containing tmw.exe:
libpng1.dll
zlib.dll
+And also make sure you have:
+
+ libxml2.dll
+ iconv.dll
+ zlib1.dll
+
Have fun hacking The Mana World!
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.
diff --git a/tmw.ini b/tmw.ini
index 7b38a017..dfad3ebb 100644
--- a/tmw.ini
+++ b/tmw.ini
@@ -8,5 +8,5 @@ sound=0
stretch=0
system=
url=http://localhost/
-username=player
+username=Player
version=0.200000