From bf93372ca26375e392ff62a91db4de4c126dff38 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 22 Nov 2009 13:22:53 +0000 Subject: (svn r18220) -Codechange: Reduce number of nested widget dynamic casts. --- src/depot_gui.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/depot_gui.cpp') diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 41d0e2de2..434e69272 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -942,13 +942,14 @@ struct DepotWindow : Window { virtual void OnResize() { - this->vscroll.SetCapacity(this->GetWidget(DEPOT_WIDGET_MATRIX)->current_y / (int)this->resize.step_height); + NWidgetCore *nwi = this->GetWidget(DEPOT_WIDGET_MATRIX); + this->vscroll.SetCapacity(nwi->current_y / (int)this->resize.step_height); if (this->type == VEH_TRAIN) { - this->hscroll.SetCapacity(this->GetWidget(DEPOT_WIDGET_MATRIX)->current_x - this->header_width - this->count_width); - this->GetWidget(DEPOT_WIDGET_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); + this->hscroll.SetCapacity(nwi->current_x - this->header_width - this->count_width); + nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); } else { - this->hscroll.SetCapacity(this->GetWidget(DEPOT_WIDGET_MATRIX)->current_x / (int)this->resize.step_width); - this->GetWidget(DEPOT_WIDGET_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (this->hscroll.GetCapacity() << MAT_COL_START); + this->hscroll.SetCapacity(nwi->current_x / (int)this->resize.step_width); + nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (this->hscroll.GetCapacity() << MAT_COL_START); } } -- cgit v1.2.3-54-g00ecf