summaryrefslogtreecommitdiff
path: root/src/rail_gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rail_gui.cpp')
-rw-r--r--src/rail_gui.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 4a3101491..34e7034a5 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -1327,10 +1327,7 @@ public:
case BRSW_NEWST_LIST: {
const StationSpec *statspec;
- int y = (pt.y - this->GetWidget<NWidgetBase>(BRSW_NEWST_LIST)->pos_y) / this->line_height;
-
- if (y >= this->vscroll.GetCapacity()) return;
- y += this->vscroll.GetPosition();
+ int y = this->vscroll.GetScrolledRowFromWidget(pt.y, this, BRSW_NEWST_LIST, 0, this->line_height);
if (y >= _railstation.station_count) return;
/* Check station availability callback */