summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/settings.cpp10
-rw-r--r--src/settings_gui.cpp14
2 files changed, 11 insertions, 13 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index fd52880f3..19d3aa7f6 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1511,11 +1511,11 @@ const SettingDesc _patch_settings[] = {
};
static const SettingDesc _currency_settings[] = {
- SDT_VAR(CurrencySpec, rate, SLE_UINT16, S, 0, 1, 0, 100, 0, STR_NULL, NULL),
- SDT_CHR(CurrencySpec, separator, S, 0, ".", STR_NULL, NULL),
- SDT_VAR(CurrencySpec, to_euro, SLE_INT32, S, 0, 0, 0, 3000, 0, STR_NULL, NULL),
- SDT_STR(CurrencySpec, prefix, SLE_STRBQ, S, 0, NULL, STR_NULL, NULL),
- SDT_STR(CurrencySpec, suffix, SLE_STRBQ, S, 0, " credits", STR_NULL, NULL),
+ SDT_VAR(CurrencySpec, rate, SLE_UINT16, S, 0, 1, 0, UINT16_MAX, 0, STR_NULL, NULL),
+ SDT_CHR(CurrencySpec, separator, S, 0, ".", STR_NULL, NULL),
+ SDT_VAR(CurrencySpec, to_euro, SLE_INT32, S, 0, 0, MIN_YEAR, MAX_YEAR, 0, STR_NULL, NULL),
+ SDT_STR(CurrencySpec, prefix, SLE_STRBQ, S, 0, NULL, STR_NULL, NULL),
+ SDT_STR(CurrencySpec, suffix, SLE_STRBQ, S, 0, " credits", STR_NULL, NULL),
SDT_END()
};
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 */