that's not right: clamp(x,a,b) is not well-defined if a > b

This commit is contained in:
Glenn Maynard
2005-11-23 17:00:23 +00:00
parent ae712f3126
commit 1b690264e3
+2 -1
View File
@@ -245,7 +245,8 @@ void LifeMeterBar::ChangeLife( float fDeltaLife )
/* Increase by m_iRegenComboAfterFail; never push it beyond m_iMaxRegenComboAfterFail
* but don't reduce it if it's already past. */
int iNewComboToRegainLife = m_iComboToRegainLife + PREFSMAN->m_iRegenComboAfterFail;
m_iComboToRegainLife = clamp( iNewComboToRegainLife, m_iComboToRegainLife, (int)PREFSMAN->m_iMaxRegenComboAfterFail );
iNewComboToRegainLife = min( (int)PREFSMAN->m_iMaxRegenComboAfterFail, iNewComboToRegainLife );
m_iComboToRegainLife = max( m_iComboToRegainLife, iNewComboToRegainLife );
}
m_fLifePercentage += fDeltaLife;