summaryrefslogtreecommitdiff
path: root/src/settings_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-07-26 13:08:48 +0000
committeralberth <alberth@openttd.org>2010-07-26 13:08:48 +0000
commit4203e641f8a507c017d10bf40f2c3882ce596da5 (patch)
tree883a2b182b8594de0b2048900956281c4efff861 /src/settings_gui.cpp
parent97f85f7bfba286bf9a7c692b390eec8231cac9ae (diff)
downloadopenttd-4203e641f8a507c017d10bf40f2c3882ce596da5.tar.xz
(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
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);