1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 11:33:03 +01:00

Add custom currency option

Add custom currency entry to the dropdown menu of the options window
This commit is contained in:
Daniel Trujillo
2016-06-22 13:17:30 +02:00
parent 7d53b065dd
commit 9355eef5d4

View File

@@ -914,13 +914,20 @@ static void window_options_mousedown(int widgetIndex, rct_window*w, rct_widget*
dropdown_set_checked(gConfigGeneral.show_height_as_units ? 0 : 1, true);
break;
case WIDX_CURRENCY_DROPDOWN:
num_items = CURRENCY_END;
num_items = CURRENCY_END + 1; // All the currencies plus the separator
int num_ordinary_currencies = CURRENCY_END - 1; // All the currencies except custom currency
for (i = 0; i < num_items; i++) {
for (i = 0; i < num_ordinary_currencies; i++) {
gDropdownItemsFormat[i] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[i] = CurrencyDescriptors[i].stringId;
}
gDropdownItemsFormat[num_ordinary_currencies] = DROPDOWN_SEPARATOR;
gDropdownItemsFormat[num_ordinary_currencies+1] = STR_DROPDOWN_MENU_LABEL;
gDropdownItemsArgs[num_ordinary_currencies+1] = CurrencyDescriptors[CURRENCY_CUSTOM].stringId;
window_options_show_dropdown(w, widget, num_items);
dropdown_set_checked(gConfigGeneral.currency_format, true);
@@ -1181,7 +1188,11 @@ static void window_options_dropdown(rct_window *w, int widgetIndex, int dropdown
window_options_update_height_markers();
break;
case WIDX_CURRENCY_DROPDOWN:
gConfigGeneral.currency_format = (sint8)dropdownIndex;
if(dropdownIndex == CURRENCY_CUSTOM+1) { // Add 1 because the separator occupies a position
gConfigGeneral.currency_format = (sint8)dropdownIndex-1;
} else {
gConfigGeneral.currency_format = (sint8)dropdownIndex;
}
config_save_default();
gfx_invalidate_screen();
break;