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_debug_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_debug_gui.cpp')
-rw-r--r-- | src/newgrf_debug_gui.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 019bd20b9..2fcef1c72 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -423,9 +423,8 @@ struct NewGRFInspectWindow : Window { if (nif->variables == NULL) return; /* Get the line, make sure it's within the boundaries. */ - int line = (pt.y - this->GetWidget<NWidgetBase>(NIW_MAINPANEL)->pos_y - TOP_OFFSET) / this->resize.step_height; - if (line >= this->vscroll.GetCapacity()) return; - line += this->vscroll.GetPosition(); + int line = this->vscroll.GetScrolledRowFromWidget(pt.y, this, NIW_MAINPANEL, TOP_OFFSET); + if (line == INT_MAX) return; /* Find the variable related to the line */ for (const NIVariable *niv = nif->variables; niv->name != NULL; niv++, line--) { |