# HG changeset patch # User Wuzzy # Date 1549338940 -3600 # Node ID 204fb862d0e40183e9e94c09076e6d02d40719cb # Parent bd43e703608b2f62503c3b48e26834c72eb6799b Prevent displaying "Volume: 0%" when not exactly 0 diff -r bd43e703608b -r 204fb862d0e4 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Tue Feb 05 03:39:03 2019 +0100 +++ b/hedgewars/uSound.pas Tue Feb 05 04:55:40 2019 +0100 @@ -116,7 +116,7 @@ // Modifies the sound volume of the game by voldelta and returns the new volume level. function ChangeVolume(voldelta: LongInt): LongInt; -// Returns the current volume in percent +// Returns the current volume in percent. Intended for display on UI. function GetVolumePercent(): LongInt; // Returns a pointer to the voicepack with the given name. @@ -867,6 +867,12 @@ function GetVolumePercent(): LongInt; begin GetVolumePercent:= Volume * 100 div MIX_MAX_VOLUME; + // 0 and 100 will only be displayed when at min/max values + // to avoid confusion. + if ((GetVolumePercent = 0) and (Volume > 0)) then + GetVolumePercent:= 1 + else if ((GetVolumePercent = 100) and (Volume < MIX_MAX_VOLUME)) then + GetVolumePercent:= 99; end; function ChangeVolume(voldelta: LongInt): LongInt;