diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-29 18:43:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-29 18:45:18 +0300 |
commit | 373e404d20dd75e46b14451164c0914df100e236 (patch) | |
tree | 94686df259dc4b498175081a949d4fd4566185b4 | |
parent | 10fcab46c31bb5c5b44416e6b3bb497e9434f352 (diff) | |
download | plus-373e404d20dd75e46b14451164c0914df100e236.tar.gz plus-373e404d20dd75e46b14451164c0914df100e236.tar.bz2 plus-373e404d20dd75e46b14451164c0914df100e236.tar.xz plus-373e404d20dd75e46b14451164c0914df100e236.zip |
Add name into MapLayer memory object.
-rw-r--r-- | src/resources/map/maplayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/maplayer.h | 7 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 17 |
3 files changed, 23 insertions, 5 deletions
diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 03901d00a..5d81cfb09 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -46,7 +46,8 @@ #include "debug.h" -MapLayer::MapLayer(const int x, +MapLayer::MapLayer(const std::string &name, + const int x, const int y, const int width, const int height, @@ -63,6 +64,7 @@ MapLayer::MapLayer(const int x, mDrawLayerFlags(MapType::NORMAL), mSpecialLayer(nullptr), mTempLayer(nullptr), + mName(name), mTempRows(), mMask(mask), mTileCondition(tileCondition), diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index dc48fc2ef..8aa692549 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -63,7 +63,8 @@ class MapLayer final: public MemoryCounter, public ConfigListener * fringe layer. The fringe layer is the layer that draws the actors. * There can be only one fringe layer per map. */ - MapLayer(const int x, + MapLayer(const std::string &name, + const int x, const int y, const int width, const int height, @@ -168,6 +169,9 @@ class MapLayer final: public MemoryCounter, public ConfigListener int calcMemoryChilds(const int level) const override final; + std::string getCounterName() const override final + { return mName; } + protected: static int getTileDrawWidth(const TileInfo *restrict img, const int endX, @@ -188,6 +192,7 @@ class MapLayer final: public MemoryCounter, public ConfigListener MapTypeT mDrawLayerFlags; const SpecialLayer *restrict mSpecialLayer; const SpecialLayer *restrict mTempLayer; + const std::string mName; typedef std::vector<MapRowVertexes*> MapRows; MapRows mTempRows; int mMask; diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 8fda33a9b..f37792fa2 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -896,7 +896,8 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map) { case MapLayer::TILES: { - layer = new MapLayer(offsetX, offsetY, + layer = new MapLayer(name, + offsetX, offsetY, w, h, isFringeLayer, mask, @@ -1177,9 +1178,19 @@ 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, -1); + MapLayer *layer = new MapLayer("nolayer", + 0, 0, + 300, 300, + false, + 1, + -1); map->addLayer(layer); - layer = new MapLayer(0, 0, 300, 300, true, 1, -1); + layer = new MapLayer("nolayer", + 0, 0, + 300, 300, + true, + 1, + -1); map->addLayer(layer); map->updateDrawLayersList(); |