summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/resources/map/map.cpp3
-rw-r--r--src/resources/map/objectslayer.cpp6
-rw-r--r--src/resources/map/objectslayer.h10
3 files changed, 17 insertions, 2 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp
index 01f646877..7045706e1 100644
--- a/src/resources/map/map.cpp
+++ b/src/resources/map/map.cpp
@@ -1743,7 +1743,8 @@ int Map::calcMemoryChilds(const int level) const
mSpecialLayer->calcMemory(level + 1);
if (mTempLayer)
mTempLayer->calcMemory(level + 1);
- // +++ need calc mObjects
+ if (mObjects)
+ mObjects->calcMemory(level + 1);
// +++ need calc mHeights
return sz;
}
diff --git a/src/resources/map/objectslayer.cpp b/src/resources/map/objectslayer.cpp
index ea4f6a27f..7af758d7f 100644
--- a/src/resources/map/objectslayer.cpp
+++ b/src/resources/map/objectslayer.cpp
@@ -74,3 +74,9 @@ MapObjectList *ObjectsLayer::getAt(const unsigned x, const unsigned y) const
return nullptr;
return mTiles[x + y * mWidth];
}
+
+int ObjectsLayer::calcMemoryLocal() const
+{
+ return sizeof(ObjectsLayer) +
+ (sizeof(MapObjectList) + sizeof(MapObjectList*)) * mWidth * mHeight;
+}
diff --git a/src/resources/map/objectslayer.h b/src/resources/map/objectslayer.h
index 629b46426..09573a627 100644
--- a/src/resources/map/objectslayer.h
+++ b/src/resources/map/objectslayer.h
@@ -21,13 +21,15 @@
#ifndef RESOURCES_MAP_OBJECTSLAYER_H
#define RESOURCES_MAP_OBJECTSLAYER_H
+#include "resources/memorycounter.h"
+
#include <string>
#include "localconsts.h"
class MapObjectList;
-class ObjectsLayer final
+class ObjectsLayer final : public MemoryCounter
{
public:
ObjectsLayer(const unsigned width, const unsigned height);
@@ -42,6 +44,12 @@ class ObjectsLayer final
MapObjectList *getAt(const unsigned x,
const unsigned y) const A_WARN_UNUSED;
+
+ int calcMemoryLocal() const override final;
+
+ std::string getCounterName() const override final
+ { return "objects leyer"; }
+
private:
MapObjectList **mTiles;
unsigned mWidth;