summaryrefslogtreecommitdiff
path: root/src/bridge_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/bridge_gui.cpp
parent97f85f7bfba286bf9a7c692b390eec8231cac9ae (diff)
downloadopenttd-4203e641f8a507c017d10bf40f2c3882ce596da5.tar.xz
(svn r20223) -Codechange: Replace scrolled row calculations by a call to GetScrolledRowFromWidget().
Diffstat (limited to 'src/bridge_gui.cpp')
-rw-r--r--src/bridge_gui.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index c11d7554f..5f3e07aab 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -249,13 +249,10 @@ public:
switch (widget) {
default: break;
case BBSW_BRIDGE_LIST: {
- uint i = ((int)pt.y - this->GetWidget<NWidgetBase>(BBSW_BRIDGE_LIST)->pos_y) / this->resize.step_height;
- if (i < this->vscroll.GetCapacity()) {
- i += this->vscroll.GetPosition();
- if (i < this->bridges->Length()) {
- this->BuildBridge(i);
- delete this;
- }
+ uint i = this->vscroll.GetScrolledRowFromWidget(pt.y, this, BBSW_BRIDGE_LIST);
+ if (i < this->bridges->Length()) {
+ this->BuildBridge(i);
+ delete this;
}
} break;