mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Fix for critical bug introduced in r9182: replace CoweringShockLevel check which calculates suppression tolerance every time, with IsCowering, which uses cowering animation check.
DrawBarsInUIBox: fix possible divide by zero. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9184 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -3620,7 +3620,7 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW
|
||||
// draw suppression shock bar
|
||||
if( gGameExternalOptions.ubShowHealthBarsOnHead > 1 )
|
||||
{
|
||||
dPercentage = (FLOAT)( __min(100, ( (FLOAT)100 * CalcEffectiveShockLevel( pSoldier ) ) / CalcSuppressionTolerance( pSoldier ) ) ) / (FLOAT)100;
|
||||
dPercentage = (min(100.0f, 100.0f * CalcEffectiveShockLevel(pSoldier) / max(1.0f, CalcSuppressionTolerance(pSoldier)))) / 100.0f;
|
||||
dWidth = dPercentage * sWidth;
|
||||
DrawBar( sXPos+3, sYPos+1+2*interval, (INT32)dWidth, sHeight, COLOR_ORANGE, Get16BPPColor( FROMRGB( 220, 140, 0 ) ), pDestBuf );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user