diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-04-26 01:24:16 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-04-26 01:24:16 +0300 |
commit | ec6bfe238af2f846a5948e95b1d725cf9abe9afb (patch) | |
tree | 0be19bc199cd66bd6949befe86c844dbad62de3b /src/resources/action.cpp | |
parent | 81dca73da50d8f421a74993de8cd5a9d61ef1e2a (diff) | |
download | plus-ec6bfe238af2f846a5948e95b1d725cf9abe9afb.tar.gz plus-ec6bfe238af2f846a5948e95b1d725cf9abe9afb.tar.bz2 plus-ec6bfe238af2f846a5948e95b1d725cf9abe9afb.tar.xz plus-ec6bfe238af2f846a5948e95b1d725cf9abe9afb.zip |
Add memory count functions into Action and Animation.
Diffstat (limited to 'src/resources/action.cpp')
-rw-r--r-- | src/resources/action.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/resources/action.cpp b/src/resources/action.cpp index 9def0fc41..a8bf83673 100644 --- a/src/resources/action.cpp +++ b/src/resources/action.cpp @@ -29,6 +29,7 @@ #include "debug.h" Action::Action() noexcept : + MemoryCounter(), mAnimations(), mNumber(100) { @@ -83,3 +84,20 @@ void Action::setLastFrameDelay(const int delay) noexcept animation->setLastFrameDelay(delay); } } + +int Action::calcMemoryLocal() +{ + return sizeof(Action); +} + +int Action::calcMemoryChilds(const int level) +{ + int sz = 0; + FOR_EACH (AnimationIter, it, mAnimations) + { + sz += sizeof(SpriteDirection::Type); + Animation *const animation = (*it).second; + sz += animation->calcMemory(level + 1); + } + return sz; +} |