summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/settings_gui.cpp')
-rw-r--r--src/settings_gui.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index abb0bf389..3ec335146 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1550,11 +1550,8 @@ struct GameSettingsWindow : Window {
{
if (widget != SETTINGSEL_OPTIONSPANEL) return;
- int y = pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y - SETTINGTREE_TOP_OFFSET; // Shift y coordinate
- if (y < 0) return; // Clicked above first entry
-
- byte btn = this->vscroll.GetPosition() + y / this->resize.step_height; // Compute which setting is selected
- if (y % this->resize.step_height > this->resize.step_height - 2) return; // Clicked too low at the setting
+ uint btn = this->vscroll.GetScrolledRowFromWidget(pt.y, this, SETTINGSEL_OPTIONSPANEL, SETTINGTREE_TOP_OFFSET - 1);
+ if (btn == INT_MAX) return;
uint cur_row = 0;
SettingEntry *pe = _settings_main_page.FindEntry(btn, &cur_row);