summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-09 00:38:26 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-09 00:50:20 +0300
commit59302a2460ad879ea662fec0b808dfe5e6dd36c0 (patch)
treebd641d6dcf02c243dca490e1ad71f65d781d17c3 /src/resources/mapreader.cpp
parentd061339a3cccf6c3e0d6b70d5cafb0da30ea16c2 (diff)
downloadmv-59302a2460ad879ea662fec0b808dfe5e6dd36c0.tar.gz
mv-59302a2460ad879ea662fec0b808dfe5e6dd36c0.tar.bz2
mv-59302a2460ad879ea662fec0b808dfe5e6dd36c0.tar.xz
mv-59302a2460ad879ea662fec0b808dfe5e6dd36c0.zip
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.
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 =