Update of /cvsroot/super-tux/supertux/lib/special
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2964/lib/special
Modified Files:
sprite.cpp sprite.h
Log Message:
Changed next action behavior.
Index: sprite.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sprite.cpp 17 Aug 2004 23:01:58 -0000 1.13
+++ sprite.cpp 17 Aug 2004 23:22:47 -0000 1.14
@@ -98,17 +98,20 @@
void
Sprite::set_action(std::string act)
{
+if(!next_action.empty() && animation_loops > 0)
+ {
+ next_action = act;
+ return;
+ }
Actions::iterator i = actions.find(act);
action = i->second;
}
void
-Sprite::start_animation(int loops, std::string next_act)
+Sprite::start_animation(int loops)
{
reset();
animation_loops = loops;
-if(!next_act.empty())
- next_action = next_act;
}
void
Index: sprite.h
===================================================================
RCS file: /cvsroot/super-tux/supertux/lib/special/sprite.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- sprite.h 17 Aug 2004 23:01:58 -0000 1.10
+++ sprite.h 17 Aug 2004 23:22:47 -0000 1.11
@@ -64,9 +64,8 @@
/* Start an animation
-1 - for infinite
0 - stopped
- 1,2,3 - one, two, three times...
- If next_act specified, that action will be used when animation ends. */
- void start_animation(int loops, std::string next_act = "");
+ 1,2,3 - one, two, three times... */
+ void start_animation(int loops);
/** Check if animation is stopped or not */
bool check_animation();
/** Reverse the animation */
@@ -117,7 +116,7 @@
Actions actions;
Action* action;
- std::string next_action;
+ std::string next_action;
};
} //namespace SuperTux
|