summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index e40acd77..50d7cf67 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -1,9 +1,8 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2004 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Mana World.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,22 +19,22 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <cassert>
-#include <iostream>
-#include <zlib.h>
+#include "resources/animation.h"
+#include "resources/image.h"
+#include "resources/mapreader.h"
+#include "resources/resourcemanager.h"
-#include "animation.h"
-#include "image.h"
-#include "mapreader.h"
-#include "resourcemanager.h"
+#include "log.h"
+#include "map.h"
+#include "tileset.h"
-#include "../log.h"
-#include "../map.h"
-#include "../tileset.h"
+#include "utils/base64.h"
+#include "utils/stringutils.h"
+#include "utils/xml.h"
-#include "../utils/base64.h"
-#include "../utils/stringutils.h"
-#include "../utils/xml.h"
+#include <cassert>
+#include <iostream>
+#include <zlib.h>
const unsigned int DEFAULT_TILE_WIDTH = 32;
const unsigned int DEFAULT_TILE_HEIGHT = 32;
@@ -311,7 +310,8 @@ static void setTile(Map *map, MapLayer *layer, int x, int y, int gid)
layer->setTile(x, y, img);
} else {
// Set collision tile
- map->setWalk(x, y, (!set || (gid - set->getFirstGid() == 0)));
+ if (set && (gid - set->getFirstGid() != 0))
+ map->blockTile(x, y, Map::BLOCKTYPE_WALL);
}
}
@@ -361,12 +361,12 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
xmlNodePtr dataChild = childNode->xmlChildrenNode;
if (!dataChild)
continue;
-
+
int len = strlen((const char*)dataChild->content) + 1;
unsigned char *charData = new unsigned char[len + 1];
const char *charStart = (const char*)dataChild->content;
unsigned char *charIndex = charData;
-
+
while (*charStart) {
if (*charStart != ' ' && *charStart != '\t' &&
*charStart != '\n')
@@ -428,10 +428,10 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
else {
- // Read plain XML map file
- for_each_xml_child_node(childNode2, childNode)
- {
- if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
+ // Read plain XML map file
+ for_each_xml_child_node(childNode2, childNode)
+ {
+ if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
continue;
const int gid = XML::getProperty(childNode2, "gid", -1);
@@ -445,12 +445,12 @@ void MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
}
-
+
if (y < h)
std::cerr << "TOO SMALL!\n";
if (x)
std::cerr << "TOO SMALL!\n";
-
+
// There can be only one data element
break;
}
@@ -524,7 +524,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node,
// create animation
if (!set) continue;
- Animation *ani = new Animation();
+ Animation *ani = new Animation;
for (int i = 0; ;i++)
{
std::map<std::string, int>::iterator iFrame, iDelay;