| 1409 | } |
| 1410 | |
| 1411 | void OnDropdownSelect(WidgetID widget, int index, int) override |
| 1412 | { |
| 1413 | switch (widget) { |
| 1414 | case WID_GO_CURRENCY_DROPDOWN: // Currency |
| 1415 | if (index == CURRENCY_CUSTOM) ShowCustCurrency(); |
| 1416 | this->opt->locale.currency = index; |
| 1417 | ReInitAllWindows(false); |
| 1418 | break; |
| 1419 | |
| 1420 | case WID_GO_AUTOSAVE_DROPDOWN: // Autosave options |
| 1421 | _settings_client.gui.autosave_interval = _autosave_dropdown_to_minutes[index]; |
| 1422 | ChangeAutosaveFrequency(false); |
| 1423 | this->SetDirty(); |
| 1424 | break; |
| 1425 | |
| 1426 | case WID_GO_LANG_DROPDOWN: // Change interface language |
| 1427 | ReadLanguagePack(&_languages[index]); |
| 1428 | CloseWindowByClass(WC_QUERY_STRING); |
| 1429 | CheckForMissingGlyphs(); |
| 1430 | ClearAllCachedNames(); |
| 1431 | UpdateAllVirtCoords(); |
| 1432 | CheckBlitter(); |
| 1433 | ReInitAllWindows(false); |
| 1434 | break; |
| 1435 | |
| 1436 | case WID_GO_RESOLUTION_DROPDOWN: // Change resolution |
| 1437 | if ((uint)index < _resolutions.size() && ChangeResInGame(_resolutions[index].width, _resolutions[index].height)) { |
| 1438 | this->SetDirty(); |
| 1439 | } |
| 1440 | break; |
| 1441 | |
| 1442 | case WID_GO_REFRESH_RATE_DROPDOWN: { |
| 1443 | _settings_client.gui.refresh_rate = *std::next(_refresh_rates.begin(), index); |
| 1444 | if (_settings_client.gui.refresh_rate > 60) { |
| 1445 | /* Show warning to the user that this refresh rate might not be suitable on |
| 1446 | * larger maps with many NewGRFs and vehicles. */ |
| 1447 | ShowErrorMessage(GetEncodedString(STR_GAME_OPTIONS_REFRESH_RATE_WARNING), {}, WL_INFO); |
| 1448 | } |
| 1449 | break; |
| 1450 | } |
| 1451 | |
| 1452 | case WID_GO_BASE_GRF_DROPDOWN: |
| 1453 | if (_game_mode == GM_MENU) { |
| 1454 | CloseWindowByClass(WC_GRF_PARAMETERS); |
| 1455 | auto set = BaseGraphics::GetSet(index); |
| 1456 | BaseGraphics::SetSet(set); |
| 1457 | this->reload = true; |
| 1458 | this->InvalidateData(); |
| 1459 | } |
| 1460 | break; |
| 1461 | |
| 1462 | case WID_GO_BASE_SFX_DROPDOWN: |
| 1463 | ChangeSoundSet(index); |
| 1464 | break; |
| 1465 | |
| 1466 | case WID_GO_BASE_MUSIC_DROPDOWN: |
| 1467 | ChangeMusicSet(index); |
| 1468 | break; |
nothing calls this directly
no test coverage detected