summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-10 16:32:12 +0000
committerrubidium <rubidium@openttd.org>2009-07-10 16:32:12 +0000
commit24305a68ee6dc050e9d70f2c50be8ec695b4d4fb (patch)
tree4cc63ff0463a12a735aa67b6612427d39a346762
parentbc32b7dc4c81be250905be633b4b3c1d126c590a (diff)
downloadopenttd-24305a68ee6dc050e9d70f2c50be8ec695b4d4fb.tar.xz
(svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive".
-rw-r--r--src/settings_gui.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 126d2df10..587a664a2 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1479,7 +1479,12 @@ struct GameSettingsWindow : Window {
/* Increase or decrease the value and clamp it to extremes */
if (x >= 10) {
value += step;
- if ((uint32)value > sdb->max) value = (int32)sdb->max;
+ if (sdb->min < 0) {
+ assert((int32)sdb->max >= 0);
+ if (value > (int32)sdb->max) value = (int32)sdb->max;
+ } else {
+ if ((uint32)value > sdb->max) value = (int32)sdb->max;
+ }
if (value < sdb->min) value = sdb->min; // skip between "disabled" and minimum
} else {
value -= step;