diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-10-21 20:31:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-10-21 20:31:25 +0300 |
commit | 27a943e95196a58103814edf3e4e3cd3a60ed8cd (patch) | |
tree | c68eedc10e7a1eba18d2c4209c8f7bc28e6673fd /src | |
parent | 1888670781a0a8f4d14f58e5eab9173feeddfe46 (diff) | |
download | manaplus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.tar.gz manaplus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.tar.bz2 manaplus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.tar.xz manaplus-27a943e95196a58103814edf3e4e3cd3a60ed8cd.zip |
Add map layer attribute TileCondition.
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/map/maplayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/maplayer.h | 5 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 15 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 51691925b..57583aef9 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -47,7 +47,8 @@ MapLayer::MapLayer(const int x, const int y, const int width, const int height, const bool fringeLayer, - const int mask) : + const int mask, + const int tileCondition) : mX(x), mY(y), mWidth(width), @@ -58,6 +59,7 @@ MapLayer::MapLayer(const int x, const int y, mTempLayer(nullptr), mTempRows(), mMask(mask), + mTileCondition(tileCondition), mActorsFix(0), mIsFringeLayer(fringeLayer), mHighlightAttackRange(config.getBoolValue("highlightAttackRange")), diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index 8c36fa771..2c1832691 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -60,7 +60,9 @@ class MapLayer final: public ConfigListener */ MapLayer(const int x, const int y, const int width, const int height, - const bool isFringeLayer, const int mask); + const bool isFringeLayer, + const int mask, + const int tileCondition); A_DELETE_COPY(MapLayer) @@ -166,6 +168,7 @@ class MapLayer final: public ConfigListener typedef std::vector<MapRowVertexes*> MapRows; MapRows mTempRows; int mMask; + int mTileCondition; int mActorsFix; const bool mIsFringeLayer; /**< Whether the actors are drawn. */ bool mHighlightAttackRange; 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(); |