fix division by zero causing m_fTrailingPercent to be NaN (results in
the life bar getting "stuck" full)
This commit is contained in:
@@ -52,6 +52,9 @@ void StreamDisplay::Update( float fDeltaSecs )
|
|||||||
// Just move straight to either full or empty.
|
// Just move straight to either full or empty.
|
||||||
if( m_fPercent <= 0 || m_fPercent >= 1 )
|
if( m_fPercent <= 0 || m_fPercent >= 1 )
|
||||||
{
|
{
|
||||||
|
if( fabsf(fDelta) < 0.00001f )
|
||||||
|
m_fVelocity = 0; // prevent div/0
|
||||||
|
else
|
||||||
m_fVelocity = (fDelta / fabsf(fDelta)) * 4;
|
m_fVelocity = (fDelta / fabsf(fDelta)) * 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user