mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-18 09:52:44 +01:00
Codechange: Let ClickSliderWidget handle rounding to nearest mark.
This commit is contained in:
committed by
Peter Nelson
parent
9d2efd4c96
commit
9a7c30a109
@@ -786,8 +786,7 @@ struct GameOptionsWindow : Window {
|
||||
#endif /* HAS_TRUETYPE_FONT */
|
||||
|
||||
case WID_GO_GUI_SCALE:
|
||||
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE, this->gui_scale)) {
|
||||
if (!_ctrl_pressed) this->gui_scale = ((this->gui_scale + 12) / 25) * 25;
|
||||
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, MIN_INTERFACE_SCALE, MAX_INTERFACE_SCALE, _ctrl_pressed ? 0 : SCALE_NMARKS, this->gui_scale)) {
|
||||
this->SetWidgetDirty(widget);
|
||||
}
|
||||
|
||||
@@ -822,7 +821,7 @@ struct GameOptionsWindow : Window {
|
||||
case WID_GO_BASE_SFX_VOLUME:
|
||||
case WID_GO_BASE_MUSIC_VOLUME: {
|
||||
uint8_t &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol;
|
||||
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, 0, INT8_MAX, vol)) {
|
||||
if (ClickSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, 0, INT8_MAX, 0, vol)) {
|
||||
if (widget == WID_GO_BASE_MUSIC_VOLUME) {
|
||||
MusicDriver::GetInstance()->SetVolume(vol);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user