summaryrefslogtreecommitdiff
path: root/src/bridge_gui.cpp
diff options
context:
space:
mode:
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;