Skip to content

Commit

Permalink
Only send lifechanged messages if the life value has actually changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Feeney committed Aug 30, 2016
1 parent 072cdd5 commit a2129a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/LifeMeterBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,17 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
break;
}

float InitialLife = m_fLifePercentage;

m_fLifePercentage += fDeltaLife;
CLAMP( m_fLifePercentage, 0, LIFE_MULTIPLIER );
AfterLifeChanged();

// Default theme metrics states that LifeMultiplier is used ONLY for debug. Clearly not true. -Mina
CLAMP( m_fLifePercentage, 0, LIFE_MULTIPLIER );


// Only send life changed messages if the life value has actually changed. -Mina
if( InitialLife != m_fLifePercentage )
AfterLifeChanged();
}

void LifeMeterBar::SetLife(float value)
Expand Down

0 comments on commit a2129a3

Please sign in to comment.