mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-04 13:23:46 +00:00
(svn r14938) -Fix: some small inconsistencies w.r.t. "0 is disabled" setting handling
This commit is contained in:
parent
4fafb723aa
commit
b26cee21f6
@ -370,8 +370,7 @@ static void Write_ValidateSetting(void *ptr, const SettingDesc *sd, int32 val)
|
||||
case SLE_VAR_U16:
|
||||
case SLE_VAR_I32: {
|
||||
/* Override the minimum value. No value below sdb->min, except special value 0 */
|
||||
int32 min = ((sdb->flags & SGF_0ISDISABLED) && val <= sdb->min) ? 0 : sdb->min;
|
||||
val = Clamp(val, min, sdb->max);
|
||||
if (!(sdb->flags & SGF_0ISDISABLED) || val != 0) val = Clamp(val, sdb->min, sdb->max);
|
||||
} break;
|
||||
case SLE_VAR_U32: {
|
||||
/* Override the minimum value. No value below sdb->min, except special value 0 */
|
||||
|
@ -854,7 +854,7 @@ struct PatchesSelectionWindow : Window {
|
||||
value = (int32)ReadValue(var, sd->save.conv);
|
||||
|
||||
/* Draw [<][>] boxes for settings of an integer-type */
|
||||
DrawArrowButtons(x, y, COLOUR_YELLOW, state, (editable && value != sdb->min), (editable && value != sdb->max));
|
||||
DrawArrowButtons(x, y, COLOUR_YELLOW, state, editable && value != (sdb->flags & SGF_0ISDISABLED ? 0 : sdb->min), editable && value != sdb->max);
|
||||
|
||||
disabled = (value == 0) && (sdb->flags & SGF_0ISDISABLED);
|
||||
if (disabled) {
|
||||
|
Loading…
Reference in New Issue
Block a user