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/town_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/town_gui.cpp')
-rw-r--r-- | src/town_gui.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp index dc6864f20..4d5cddb1c 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -873,12 +873,7 @@ public: break; case TDW_CENTERTOWN: { // Click on Town Matrix - uint16 id_v = (pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height; - - if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds - - id_v += this->vscroll.GetPosition(); - + uint id_v = this->vscroll.GetScrolledRowFromWidget(pt.y, this, TDW_CENTERTOWN, WD_FRAMERECT_TOP); if (id_v >= this->towns.Length()) return; // click out of town bounds const Town *t = this->towns[id_v]; |