diff options
-rw-r--r-- | src/resources/map/map.cpp | 3 | ||||
-rw-r--r-- | src/resources/map/mapheights.cpp | 6 | ||||
-rw-r--r-- | src/resources/map/mapheights.h | 9 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 7045706e1..51bd7952c 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -1745,6 +1745,7 @@ int Map::calcMemoryChilds(const int level) const mTempLayer->calcMemory(level + 1); if (mObjects) mObjects->calcMemory(level + 1); - // +++ need calc mHeights + if (mHeights) + mHeights->calcMemory(level + 1); return sz; } diff --git a/src/resources/map/mapheights.cpp b/src/resources/map/mapheights.cpp index b4347cd1f..5d5c30aa8 100644 --- a/src/resources/map/mapheights.cpp +++ b/src/resources/map/mapheights.cpp @@ -39,3 +39,9 @@ void MapHeights::setHeight(const int x, const int y, const uint8_t height) { mTiles[x + y * mWidth] = height; } + +int MapHeights::calcMemoryLocal() const +{ + return sizeof(MapHeights) + + mWidth * mHeight; +} diff --git a/src/resources/map/mapheights.h b/src/resources/map/mapheights.h index 333e7fac4..86962c0de 100644 --- a/src/resources/map/mapheights.h +++ b/src/resources/map/mapheights.h @@ -21,9 +21,11 @@ #ifndef RESOURCES_MAP_MAPHEIGHTS_H #define RESOURCES_MAP_MAPHEIGHTS_H +#include "resources/memorycounter.h" + #include "localconsts.h" -class MapHeights final +class MapHeights final : public MemoryCounter { public: friend class Map; @@ -40,6 +42,11 @@ class MapHeights final { return x < mWidth && y < mHeight ? mTiles[x + y * mWidth] : CAST_U8(0U); } + int calcMemoryLocal() const override final; + + std::string getCounterName() const override final + { return "heights leyer"; } + private: int mWidth; int mHeight; |