summaryrefslogtreecommitdiff
path: root/src/signs_gui.cpp
diff options
context:
space:
mode:
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));