From 7778c082e9b15774a1e79ab77cb60edb5c3a2949 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Sep 2017 21:51:33 +0300 Subject: Add some checks after automatic check code by tools. --- src/resources/sprite/spritedef.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/resources') diff --git a/src/resources/sprite/spritedef.cpp b/src/resources/sprite/spritedef.cpp index 5fdb68584..aa79ef9f8 100644 --- a/src/resources/sprite/spritedef.cpp +++ b/src/resources/sprite/spritedef.cpp @@ -142,8 +142,12 @@ void SpriteDef::fixDeadAction() const ActionMap::iterator i = d->find(SpriteAction::DEAD); const ActionMap::iterator i2 = d->find(SpriteAction::STAND); // search dead action and check what it not same with stand action - if (i != d->end() && (i->second != nullptr) && i->second != i2->second) + if (i != d->end() && + i->second != nullptr && + (i2 == d->end() || i->second != i2->second)) + { (i->second)->setLastFrameDelay(0); + } } } @@ -300,9 +304,13 @@ void SpriteDef::loadAction(XmlNodeConstPtr node, // dirty hack to fix bad resources in tmw server if (actionName == "attack_stab") + { + reportAlways("Found legacy attribute attack_stab in animation"); addAction(hp, "attack", action); + } - // When first action set it as default direction + // When first action, set it as default direction. + // i here always correct, because hp was added above. const Actions::const_iterator i = mActions.find(hp); if ((*i).second->size() == 1) addAction(hp, SpriteAction::DEFAULT, action); -- cgit v1.2.3-60-g2f50