summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-26 21:18:45 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-26 23:23:32 +0300
commit0380eec2d9d03a2541e4f89640f452fb96a7914a (patch)
tree78d28c04511d26956fe5dad1bff30063cd755a88 /src/resources/mapreader.cpp
parent344fc37de3bbc385e04ee4109600625f9aefbeba (diff)
downloadManaVerse-0380eec2d9d03a2541e4f89640f452fb96a7914a.tar.gz
ManaVerse-0380eec2d9d03a2541e4f89640f452fb96a7914a.tar.bz2
ManaVerse-0380eec2d9d03a2541e4f89640f452fb96a7914a.tar.xz
ManaVerse-0380eec2d9d03a2541e4f89640f452fb96a7914a.zip
Loading map layer masks from layer properties.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 95da2ae36..a1b087102 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -666,6 +666,7 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
const bool isFringeLayer = (name.substr(0, 6) == "fringe");
const bool isCollisionLayer = (name.substr(0, 9) == "collision");
const bool isHeightLayer = (name.substr(0, 7) == "heights");
+ int mask = 1;
MapLayer::Type layerType = MapLayer::TILES;
if (isCollisionLayer)
@@ -694,12 +695,25 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
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 (pname == "NotVersion" && value <= CHECK_VERSION)
- return;
+ if (pname == "Hidden")
+ {
+ if (value == "1")
+ return;
+ }
+ else if (pname == "Version")
+ {
+ if (value > CHECK_VERSION)
+ return;
+ }
+ else if (pname == "NotVersion")
+ {
+ if (value <= CHECK_VERSION)
+ return;
+ }
+ else if (pname == "Mask")
+ {
+ mask = atoi(value.c_str());
+ }
}
}
@@ -708,7 +722,7 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
if (layerType == MapLayer::TILES)
{
- layer = new MapLayer(offsetX, offsetY, w, h, isFringeLayer);
+ layer = new MapLayer(offsetX, offsetY, w, h, isFringeLayer, mask);
map->addLayer(layer);
}
else if (layerType == MapLayer::HEIGHTS)
@@ -939,9 +953,9 @@ Map *MapReader::createEmptyMap(const std::string &filename,
map->setProperty("_realfilename", filename);
updateMusic(map);
map->setCustom(true);
- MapLayer *layer = new MapLayer(0, 0, 300, 300, false);
+ MapLayer *layer = new MapLayer(0, 0, 300, 300, false, 1);
map->addLayer(layer);
- layer = new MapLayer(0, 0, 300, 300, true);
+ layer = new MapLayer(0, 0, 300, 300, true, 1);
map->addLayer(layer);
return map;