summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-30 14:35:44 +0000
committerfrosch <frosch@openttd.org>2013-06-30 14:35:44 +0000
commit634607573f24e8b7b20bb54ed7cee28437fe8386 (patch)
tree420daa62126337217aa3deec31d8d62e42dbd20e /src
parentdf732f2bae50510799e072ed10ac658711ed4907 (diff)
downloadopenttd-634607573f24e8b7b20bb54ed7cee28437fe8386.tar.xz
(svn r25535) -Fix [FS#5584]: Initialise scrollbars before FinishInitNested, so their capacity is set via OnResize.
Diffstat (limited to 'src')
-rw-r--r--src/rail_gui.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index a3642e5c3..37c076f21 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -929,6 +929,10 @@ public:
newst_additions->SetDisplayedPlane(newstation ? 0 : SZSP_NONE);
newst_additions = this->GetWidget<NWidgetStacked>(WID_BRAS_SHOW_NEWST_RESIZE);
newst_additions->SetDisplayedPlane(newstation ? 0 : SZSP_NONE);
+ if (newstation) {
+ this->vscroll = this->GetScrollbar(WID_BRAS_NEWST_SCROLL);
+ this->vscroll2 = this->GetScrollbar(WID_BRAS_MATRIX_SCROLL);
+ }
this->FinishInitNested(TRANSPORT_RAIL);
this->LowerWidget(_railstation.orientation + WID_BRAS_PLATFORM_DIR_X);
@@ -957,12 +961,9 @@ public:
if (i == STAT_CLASS_WAYP) continue;
count++;
}
- this->vscroll = this->GetScrollbar(WID_BRAS_NEWST_SCROLL);
this->vscroll->SetCount(count);
- this->vscroll->SetCapacity(GB(this->GetWidget<NWidgetCore>(WID_BRAS_NEWST_LIST)->widget_data, MAT_ROW_START, MAT_ROW_BITS));
this->vscroll->SetPosition(Clamp(_railstation.station_class - 2, 0, max(this->vscroll->GetCount() - this->vscroll->GetCapacity(), 0)));
- this->vscroll2 = this->GetScrollbar(WID_BRAS_MATRIX_SCROLL);
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BRAS_MATRIX);
matrix->SetScrollbar(this->vscroll2);
matrix->SetCount(_railstation.station_count);