summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-21 20:31:25 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-21 20:31:25 +0300
commit27a943e95196a58103814edf3e4e3cd3a60ed8cd (patch)
treec68eedc10e7a1eba18d2c4209c8f7bc28e6673fd /src/resources/mapreader.cpp
parent1888670781a0a8f4d14f58e5eab9173feeddfe46 (diff)
downloadplus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.tar.gz
plus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.tar.bz2
plus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.tar.xz
plus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.zip
Add map layer attribute TileCondition.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 9b87d821c..4fbef0d1b 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -764,6 +764,7 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
const bool isCollisionLayer = (name.substr(0, 9) == "collision");
const bool isHeightLayer = (name.substr(0, 7) == "heights");
int mask = 1;
+ int tileCondition = -1;
MapLayer::Type layerType = MapLayer::TILES;
if (isCollisionLayer)
@@ -811,6 +812,10 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
{
mask = atoi(value.c_str());
}
+ else if (pname == "TileCondition")
+ {
+ tileCondition = atoi(value.c_str());
+ }
}
}
@@ -819,7 +824,11 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map)
if (layerType == MapLayer::TILES)
{
- layer = new MapLayer(offsetX, offsetY, w, h, isFringeLayer, mask);
+ layer = new MapLayer(offsetX, offsetY,
+ w, h,
+ isFringeLayer,
+ mask,
+ tileCondition);
map->addLayer(layer);
}
else if (layerType == MapLayer::HEIGHTS)
@@ -1079,9 +1088,9 @@ Map *MapReader::createEmptyMap(const std::string &restrict filename,
map->setProperty("_realfilename", filename);
updateMusic(map);
map->setCustom(true);
- MapLayer *layer = new MapLayer(0, 0, 300, 300, false, 1);
+ MapLayer *layer = new MapLayer(0, 0, 300, 300, false, 1, -1);
map->addLayer(layer);
- layer = new MapLayer(0, 0, 300, 300, true, 1);
+ layer = new MapLayer(0, 0, 300, 300, true, 1, -1);
map->addLayer(layer);
map->updateDrawLayersList();