fix bogus initial calorie number

This commit is contained in:
Chris Danford
2005-04-04 09:21:16 +00:00
parent 39d06f6e24
commit 8b5f3c3e55
2 changed files with 16 additions and 4 deletions
+14 -4
View File
@@ -37,11 +37,19 @@ void ScoreDisplayCalories::LoadFromNode( const CString& sDir, const XNode* pNode
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
UpdateNumber();
MESSAGEMAN->Subscribe( this, m_sMessageOnStep );
}
void ScoreDisplayCalories::Update( float fDelta )
{
// We have to set the initial text after StatsManager::CalcAccumStageStats
// is called.
if( IsFirstUpdate() )
UpdateNumber();
RollingNumbers::Update( fDelta );
}
void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
{
if( sCommandName == m_sMessageOnStep )
@@ -54,8 +62,10 @@ void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
void ScoreDisplayCalories::UpdateNumber()
{
float fCals = STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned;
fCals += STATSMAN->GetAccumStageStats().m_player[m_PlayerNumber].fCaloriesBurned;
float fCals =
STATSMAN->GetAccumStageStats().m_player[m_PlayerNumber].fCaloriesBurned +
STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned;
SetTargetNumber( fCals );
}
+2
View File
@@ -26,6 +26,8 @@ public:
ScoreDisplayCalories();
~ScoreDisplayCalories();
virtual void Update( float fDelta );
void LoadFromNode( const CString& sDir, const XNode* pNode );
void PlayCommand( const CString &sCommandName );