summaryrefslogtreecommitdiff
path: root/src/signs_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/signs_gui.cpp
parent97f85f7bfba286bf9a7c692b390eec8231cac9ae (diff)
downloadopenttd-4203e641f8a507c017d10bf40f2c3882ce596da5.tar.xz
(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
Diffstat (limited to 'src/signs_gui.cpp')
-rw-r--r--src/signs_gui.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 237af085e..a054d0fed 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -148,11 +148,8 @@ struct SignListWindow : Window, SignList {
virtual void OnClick(Point pt, int widget, int click_count)
{
if (widget == SLW_LIST) {
- uint id_v = (pt.y - this->GetWidget<NWidgetBase>(SLW_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height;
-
- if (id_v >= this->vscroll.GetCapacity()) return;
- id_v += this->vscroll.GetPosition();
- if (id_v >= this->vscroll.GetCount()) return;
+ uint id_v = this->vscroll.GetScrolledRowFromWidget(pt.y, this, SLW_LIST, WD_FRAMERECT_TOP);
+ if (id_v == INT_MAX) return;
const Sign *si = this->signs[id_v];
ScrollMainWindowToTile(TileVirtXY(si->x, si->y));