From 842bf8f1a3f19c9332bd0df38b2e0f8c01a9d750 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 25 Jul 2004 22:43:05 +0000 Subject: [PATCH] fix ActiveAttackList doesn't show Attacks that started at the very beginning of a Course --- stepmania/src/ActiveAttackList.cpp | 66 ++++++++++++++++-------------- stepmania/src/ActiveAttackList.h | 1 + 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/stepmania/src/ActiveAttackList.cpp b/stepmania/src/ActiveAttackList.cpp index 6db4acbd92..c95206abd4 100644 --- a/stepmania/src/ActiveAttackList.cpp +++ b/stepmania/src/ActiveAttackList.cpp @@ -17,47 +17,51 @@ void ActiveAttackList::Init( PlayerNumber pn ) } void ActiveAttackList::Update( float fDelta ) -{ - BitmapText::Update( fDelta ); - - bool bTimeToUpdate = +{ + bool bTimeToRefresh = + IsFirstUpdate() || // check this before running Actor::Update() GAMESTATE->m_bAttackBeganThisUpdate[m_PlayerNumber] || GAMESTATE->m_bAttackEndedThisUpdate[m_PlayerNumber]; - if( bTimeToUpdate ) + BitmapText::Update( fDelta ); + + if( bTimeToRefresh ) + Refresh(); +} + +void ActiveAttackList::Refresh() +{ + CString s; + + const AttackArray& attacks = GAMESTATE->m_ActiveAttacks[m_PlayerNumber]; // NUM_INVENTORY_SLOTS + + // clear all lines, then add all active attacks + for( unsigned i=0; im_ActiveAttacks[m_PlayerNumber]; // NUM_INVENTORY_SLOTS - - // clear all lines, then add all active attacks - for( unsigned i=0; iSetText( s ); // BitmapText will not rebuild vertices if these strings are the same. } + + this->SetText( s ); // BitmapText will not rebuild vertices if these strings are the same. } /* diff --git a/stepmania/src/ActiveAttackList.h b/stepmania/src/ActiveAttackList.h index ccf0fd8926..447a01ed06 100644 --- a/stepmania/src/ActiveAttackList.h +++ b/stepmania/src/ActiveAttackList.h @@ -15,6 +15,7 @@ public: virtual void Update( float fDelta ); protected: + void Refresh(); PlayerNumber m_PlayerNumber; };