From 24305a68ee6dc050e9d70f2c50be8ec695b4d4fb Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 10 Jul 2009 16:32:12 +0000 Subject: (svn r16781) -Fix [FS#3026] (r16297): don't cast negative values to uints when the settings' range is "negative..positive". --- src/settings_gui.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3-70-g09d2