From 0f8b2ddf88c1cdd6bfac1e76e8173bd12f57a441 Mon Sep 17 00:00:00 2001
From: Andrei Karas <akaras@inbox.ru>
Date: Fri, 29 Apr 2016 18:51:23 +0300
Subject: Add name into SpecialLayer memory object.

---
 src/resources/map/map.cpp          |  4 ++--
 src/resources/map/speciallayer.cpp |  9 ++++++---
 src/resources/map/speciallayer.h   | 10 ++++++++--
 3 files changed, 16 insertions(+), 7 deletions(-)

(limited to 'src')

diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 93b950ba5..43ed91daf 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -120,8 +120,8 @@ Map::Map(const int width, const int height,
     mActorFixX(0),
     mActorFixY(0),
     mVersion(0),
-    mSpecialLayer(new SpecialLayer(width, height)),
-    mTempLayer(new SpecialLayer(width, height)),
+    mSpecialLayer(new SpecialLayer("special layer", width, height)),
+    mTempLayer(new SpecialLayer("temp layer", width, height)),
     mObjects(new ObjectsLayer(width, height)),
     mFringeLayer(nullptr),
     mLastX(-1),
diff --git a/src/resources/map/speciallayer.cpp b/src/resources/map/speciallayer.cpp
index e53900134..e57189d84 100644
--- a/src/resources/map/speciallayer.cpp
+++ b/src/resources/map/speciallayer.cpp
@@ -30,10 +30,13 @@
 
 #include "debug.h"
 
-SpecialLayer::SpecialLayer(const int width, const int height) :
+SpecialLayer::SpecialLayer(const std::string &name,
+                           const int width,
+                           const int height) :
+    mName(name),
+    mTiles(new MapItem*[width * height]),
     mWidth(width),
-    mHeight(height),
-    mTiles(new MapItem*[mWidth * mHeight])
+    mHeight(height)
 {
     std::fill_n(mTiles, mWidth * mHeight, static_cast<MapItem*>(nullptr));
 }
diff --git a/src/resources/map/speciallayer.h b/src/resources/map/speciallayer.h
index b8b2c251a..1c69ab4be 100644
--- a/src/resources/map/speciallayer.h
+++ b/src/resources/map/speciallayer.h
@@ -36,7 +36,9 @@ class SpecialLayer final : public MemoryCounter
         friend class Map;
         friend class MapLayer;
 
-        SpecialLayer(const int width, const int height);
+        SpecialLayer(const std::string &name,
+                     const int width,
+                     const int height);
 
         A_DELETE_COPY(SpecialLayer)
 
@@ -59,10 +61,14 @@ class SpecialLayer final : public MemoryCounter
 
         int calcMemoryLocal() const override final;
 
+        std::string getCounterName() const override final
+        { return mName; }
+
     private:
+        const std::string mName;
+        MapItem **mTiles;
         int mWidth;
         int mHeight;
-        MapItem **mTiles;
 };
 
 #endif  // RESOURCES_MAP_SPECIALLAYER_H
-- 
cgit v1.2.3-70-g09d2