From 07675230038a24dd251581591379c8fe5cc7bfd1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Apr 2016 20:11:07 +0300 Subject: Add memory count functions into MapLayer and SpecailLayer. Also change all memory count functions into const methods. --- src/resources/map/maplayer.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/resources/map/maplayer.cpp') diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 0c18bf289..03901d00a 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -744,3 +744,20 @@ void MapLayer::updateConditionTiles(MetaTile *const metaTiles, } } } + +int MapLayer::calcMemoryLocal() const +{ + return sizeof(MapLayer) + + sizeof(TileInfo) * mWidth * mHeight + + sizeof(MapRowVertexes) * mTempRows.capacity(); +} + +int MapLayer::calcMemoryChilds(const int level) const +{ + int sz = 0; + if (mSpecialLayer) + sz += mSpecialLayer->calcMemory(level + 1); + if (mTempLayer) + sz += mTempLayer->calcMemory(level + 1); + return sz; +} -- cgit v1.2.3-60-g2f50