summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2013-03-09 16:23:22 +0000
committerplanetmaker <planetmaker@openttd.org>2013-03-09 16:23:22 +0000
commitbd301e84757755f08657aaf98059c206f2480a3a (patch)
tree30828147e091c6d6f7ea195ce615b40bc8a8ab1b
parente808104b88767cdedb9e500d475b0c489f75a1ff (diff)
downloadopenttd-bd301e84757755f08657aaf98059c206f2480a3a.tar.xz
(svn r25074) -Cleanup: Simplify currency selection code slightly
-rw-r--r--src/settings_gui.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index c7229430d..50b0b880c 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -190,23 +190,17 @@ struct GameOptionsWindow : Window {
*selected_index = this->opt->locale.currency;
StringID *items = BuildCurrencyDropdown();
uint disabled = _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies();
- int custom_index = -1;
/* Add non-custom currencies; sorted naturally */
- for (uint i = 0; *items != INVALID_STRING_ID; items++, i++) {
- if (*items == STR_GAME_OPTIONS_CURRENCY_CUSTOM) {
- custom_index = i;
- } else {
- list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i)));
- }
+ for (uint i = 0; i < CURRENCY_END; items++, i++) {
+ if (i == CURRENCY_CUSTOM) continue;
+ list->push_back(new DropDownListStringItem(*items, i, HasBit(disabled, i)));
}
list->sort(DropDownListStringItem::NatSortFunc);
/* Append custom currency at the end */
- if (custom_index >= 0) {
- list->push_back(new DropDownListItem(-1, false)); // separator line
- list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, custom_index, HasBit(disabled, custom_index)));
- }
+ list->push_back(new DropDownListItem(-1, false)); // separator line
+ list->push_back(new DropDownListStringItem(STR_GAME_OPTIONS_CURRENCY_CUSTOM, CURRENCY_CUSTOM, HasBit(disabled, CURRENCY_CUSTOM)));
break;
}