diff options
author | rubidium <rubidium@openttd.org> | 2009-01-09 19:34:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-01-09 19:34:05 +0000 |
commit | b26cee21f67878182cb5d7170448f9d17c21a55f (patch) | |
tree | daee530989536bf4d3d116ac674072a06f92260f /src | |
parent | 4fafb723aa7a69ebc53c4a9f734ad2dbe5c2a3e0 (diff) | |
download | openttd-b26cee21f67878182cb5d7170448f9d17c21a55f.tar.xz |
(svn r14938) -Fix: some small inconsistencies w.r.t. "0 is disabled" setting handling
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.cpp | 3 | ||||
-rw-r--r-- | src/settings_gui.cpp | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index 4e8eb6404..665ada9d9 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -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 */ diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index e7e5bb864..9064d0bdb 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -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) { |