From 59302a2460ad879ea662fec0b808dfe5e6dd36c0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 9 Feb 2012 00:38:26 +0300 Subject: Add Hidden layer property. If it set to 1 then client will ignore this layer. Add Version layer property. It show minimal client version supported by this layer. --- src/resources/mapreader.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/resources/mapreader.cpp') 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 = -- cgit v1.2.3-60-g2f50