summaryrefslogtreecommitdiff
path: root/src/fios_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/fios_gui.cpp
parent97f85f7bfba286bf9a7c692b390eec8231cac9ae (diff)
downloadopenttd-4203e641f8a507c017d10bf40f2c3882ce596da5.tar.xz
(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
Diffstat (limited to 'src/fios_gui.cpp')
-rw-r--r--src/fios_gui.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 8ee17d4bd..7cf6bb3d4 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -531,9 +531,8 @@ public:
break;
case SLWW_DRIVES_DIRECTORIES_LIST: { // Click the listbox
- int y = (pt.y - this->GetWidget<NWidgetBase>(SLWW_DRIVES_DIRECTORIES_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height;
-
- if (y < 0 || (y += this->vscroll.GetPosition()) >= this->vscroll.GetCount()) return;
+ int y = this->vscroll.GetScrolledRowFromWidget(pt.y, this, SLWW_DRIVES_DIRECTORIES_LIST, WD_FRAMERECT_TOP);
+ if (y == INT_MAX) return;
const FiosItem *file = _fios_items.Get(y);