summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-04-29 15:27:42 +0300
committerAndrei Karas <akaras@inbox.ru>2016-04-29 15:27:42 +0300
commitcc78eca07666eec99f1a09d809568970e968b52d (patch)
tree2c012ecca6a34b25766d3ff6af83d76b8c7ff0f1
parent7c020abf511236e2c56fa1c6b6c1b8f248aa8582 (diff)
downloadmanaplus-cc78eca07666eec99f1a09d809568970e968b52d.tar.gz
manaplus-cc78eca07666eec99f1a09d809568970e968b52d.tar.bz2
manaplus-cc78eca07666eec99f1a09d809568970e968b52d.tar.xz
manaplus-cc78eca07666eec99f1a09d809568970e968b52d.zip
Add name into Action memory object.
-rw-r--r--src/resources/action.cpp3
-rw-r--r--src/resources/action.h6
-rw-r--r--src/resources/sprite/spritedef.cpp2
3 files changed, 8 insertions, 3 deletions
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index 85f716b28..a79614eef 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -28,9 +28,10 @@
#include "debug.h"
-Action::Action() noexcept :
+Action::Action(const std::string &name) noexcept :
MemoryCounter(),
mAnimations(),
+ mCounterName(name),
mNumber(100)
{
}
diff --git a/src/resources/action.h b/src/resources/action.h
index 6cf4ed0d0..e6762302f 100644
--- a/src/resources/action.h
+++ b/src/resources/action.h
@@ -39,7 +39,7 @@ class Animation;
class Action final : public MemoryCounter
{
public:
- Action() noexcept;
+ Action(const std::string &name) noexcept;
A_DELETE_COPY(Action)
@@ -63,12 +63,16 @@ class Action final : public MemoryCounter
int calcMemoryChilds(const int level) const override final;
+ std::string getCounterName() const override
+ { return mCounterName; }
+
protected:
typedef std::map<SpriteDirection::Type, Animation*> Animations;
typedef Animations::iterator AnimationIter;
typedef Animations::const_iterator AnimationCIter;
Animations mAnimations;
+ std::string mCounterName;
unsigned mNumber;
};
diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp
index 066d0b827..a19c1b267 100644
--- a/src/resources/sprite/spritedef.cpp
+++ b/src/resources/sprite/spritedef.cpp
@@ -275,7 +275,7 @@ void SpriteDef::loadAction(const XmlNodePtr node,
actionName.c_str(), getIdPath().c_str());
return;
}
- Action *const action = new Action;
+ Action *const action = new Action(actionName);
action->setNumber(hp);
addAction(hp, actionName, action);