summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-29 15:46:14 +0000
committerrubidium <rubidium@openttd.org>2008-12-29 15:46:14 +0000
commit5aa2dac7515c91223515a6e6fd3027edabd5aa59 (patch)
treefd2710348fe734e6dcd5dde5bf698c5769d576c9 /src/settings_gui.cpp
parent42fb037005d8a8ac65d5aa34b6b65acd6b9152b2 (diff)
downloadopenttd-5aa2dac7515c91223515a6e6fd3027edabd5aa59.tar.xz
(svn r14767) -Codechange: remove some unneeded artificial limits from currencies and use the bounds of the data type.
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 4566fa338..08fe287ca 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1111,13 +1111,13 @@ struct CustomCurrencyWindow : Window {
if (_custom_currency.rate > 1) _custom_currency.rate--;
this->click = 1 << (line * 2 + 0);
} else {
- if (_custom_currency.rate < 5000) _custom_currency.rate++;
+ if (_custom_currency.rate < UINT16_MAX) _custom_currency.rate++;
this->click = 1 << (line * 2 + 1);
}
} else { // enter text
SetDParam(0, _custom_currency.rate);
str = STR_CONFIG_PATCHES_INT32;
- len = 4;
+ len = 5;
afilter = CS_NUMERAL;
}
break;
@@ -1152,18 +1152,16 @@ struct CustomCurrencyWindow : Window {
case CUSTCURR_TO_EURO:
if (IsInsideMM(x, 10, 30)) { // clicked buttons
if (x < 20) {
- _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ?
- CF_NOEURO : _custom_currency.to_euro - 1;
+ _custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ? CF_NOEURO : _custom_currency.to_euro - 1;
this->click = 1 << (line * 2 + 0);
} else {
- _custom_currency.to_euro =
- Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR);
+ _custom_currency.to_euro = Clamp(_custom_currency.to_euro + 1, 2000, MAX_YEAR);
this->click = 1 << (line * 2 + 1);
}
} else { // enter text
SetDParam(0, _custom_currency.to_euro);
str = STR_CONFIG_PATCHES_INT32;
- len = 4;
+ len = 7;
afilter = CS_NUMERAL;
}
break;
@@ -1184,7 +1182,7 @@ struct CustomCurrencyWindow : Window {
switch (this->query_widget) {
case CUSTCURR_EXCHANGERATE:
- _custom_currency.rate = Clamp(atoi(str), 1, 5000);
+ _custom_currency.rate = Clamp(atoi(str), 1, UINT16_MAX);
break;
case CUSTCURR_SEPARATOR: /* Thousands seperator */