diff options
author | alberth <alberth@openttd.org> | 2010-07-26 13:08:48 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-07-26 13:08:48 +0000 |
commit | 4203e641f8a507c017d10bf40f2c3882ce596da5 (patch) | |
tree | 883a2b182b8594de0b2048900956281c4efff861 /src/newgrf_gui.cpp | |
parent | 97f85f7bfba286bf9a7c692b390eec8231cac9ae (diff) | |
download | openttd-4203e641f8a507c017d10bf40f2c3882ce596da5.tar.xz |
(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
Diffstat (limited to 'src/newgrf_gui.cpp')
-rw-r--r-- | src/newgrf_gui.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 4570cab67..2d382c96f 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -482,8 +482,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } case SNGRFS_FILE_LIST: { // Select an active GRF. - NWidgetBase *nw = this->GetWidget<NWidgetBase>(SNGRFS_FILE_LIST); - uint i = (pt.y - nw->pos_y) / nw->resize_y + this->vscroll.GetPosition(); + uint i = this->vscroll.GetScrolledRowFromWidget(pt.y, this, SNGRFS_FILE_LIST); GRFConfig *c; for (c = this->actives; c != NULL && i > 0; c = c->next, i--) {} @@ -526,8 +525,7 @@ struct NewGRFWindow : public QueryStringBaseWindow { } case SNGRFS_AVAIL_LIST: { // Select a non-active GRF. - NWidgetBase *nw = this->GetWidget<NWidgetBase>(SNGRFS_AVAIL_LIST); - uint i = (pt.y - nw->pos_y) / nw->resize_y + this->vscroll2.GetPosition(); + uint i = this->vscroll2.GetScrolledRowFromWidget(pt.y, this, SNGRFS_AVAIL_LIST); this->active_sel = NULL; if (i < this->avails.Length()) { this->avail_sel = this->avails[i]; |