fix division by zero causing m_fTrailingPercent to be NaN (results in

the life bar getting "stuck" full)
This commit is contained in:
Glenn Maynard
2005-04-26 03:57:06 +00:00
parent 416ed7786f
commit e9c2c4678d
+4 -1
View File
@@ -52,7 +52,10 @@ void StreamDisplay::Update( float fDeltaSecs )
// Just move straight to either full or empty.
if( m_fPercent <= 0 || m_fPercent >= 1 )
{
m_fVelocity = (fDelta / fabsf(fDelta)) * 4;
if( fabsf(fDelta) < 0.00001f )
m_fVelocity = 0; // prevent div/0
else
m_fVelocity = (fDelta / fabsf(fDelta)) * 4;
}
else
{