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.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index eec14685d..35a472125 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -22,6 +22,7 @@
#include "resources/mapreader.h"
+#include "client.h"
#include "configuration.h"
#include "logger.h"
#include "map.h"
@@ -460,12 +461,6 @@ void MapReader::readLayer(XmlNodePtr node, Map *map)
MapLayer *layer = nullptr;
- if (!isCollisionLayer)
- {
- layer = new MapLayer(offsetX, offsetY, w, h, isFringeLayer);
- map->addLayer(layer);
- }
-
logger->log("- Loading layer \"%s\"", name.c_str());
int x = 0;
int y = 0;
@@ -473,9 +468,31 @@ void MapReader::readLayer(XmlNodePtr node, Map *map)
// Load the tile data
for_each_xml_child_node(childNode, node)
{
+ if (serverVersion > 0 && xmlNameEqual(childNode, "properties"))
+ {
+ for_each_xml_child_node(prop, childNode)
+ {
+ if (!xmlNameEqual(prop, "property"))
+ continue;
+ const std::string pname = XML::getProperty(prop, "name", "");
+ const std::string value = XML::getProperty(prop, "value", "");
+ // ignoring any layer if property Hidden is 1
+ if (pname == "Hidden" && value == "1")
+ return;
+ if (pname == "Version" && value > CHECK_VERSION)
+ return;
+ }
+ }
+
if (!xmlNameEqual(childNode, "data"))
continue;
+ if (!isCollisionLayer)
+ {
+ layer = new MapLayer(offsetX, offsetY, w, h, isFringeLayer);
+ map->addLayer(layer);
+ }
+
const std::string encoding =
XML::getProperty(childNode, "encoding", "");
const std::string compression =