use deque in Actor for contant time delete of the head

This commit is contained in:
Chris Danford
2004-01-25 02:33:16 +00:00
parent 5144e29421
commit 80c355b3b0
2 changed files with 5 additions and 6 deletions
+2 -4
View File
@@ -261,8 +261,8 @@ void Actor::UpdateTweening( float fDeltaTime )
m_current = TS; m_current = TS;
// delete the head tween // delete the head tween
m_TweenStates.erase( m_TweenStates.begin() ); m_TweenStates.pop_front();
m_TweenInfo.erase( m_TweenInfo.begin() ); m_TweenInfo.pop_front();
} }
else // in the middle of tweening. Recalcute the current position. else // in the middle of tweening. Recalcute the current position.
{ {
@@ -380,8 +380,6 @@ void Actor::StopTweening()
{ {
m_TweenStates.clear(); m_TweenStates.clear();
m_TweenInfo.clear(); m_TweenInfo.clear();
ASSERT( m_TweenStates.empty() );
ASSERT( m_TweenInfo.empty() );
} }
void Actor::FinishTweening() void Actor::FinishTweening()
+3 -2
View File
@@ -13,6 +13,7 @@
#include "RageTypes.h" #include "RageTypes.h"
#include "ActorCommands.h" // for ParsedCommand #include "ActorCommands.h" // for ParsedCommand
#include <deque>
class Actor class Actor
{ {
@@ -319,8 +320,8 @@ protected:
RageVector2 m_size; RageVector2 m_size;
TweenState m_current; TweenState m_current;
TweenState m_start; TweenState m_start;
vector<TweenState> m_TweenStates; deque<TweenState> m_TweenStates; // use deque for contant time delete of the head
vector<TweenInfo> m_TweenInfo; deque<TweenInfo> m_TweenInfo;
TweenState& LatestTween() { ASSERT(m_TweenStates.size()>0); return m_TweenStates.back(); }; TweenState& LatestTween() { ASSERT(m_TweenStates.size()>0); return m_TweenStates.back(); };