summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-06-30 14:37:24 +0000
committerfrosch <frosch@openttd.org>2013-06-30 14:37:24 +0000
commitd798766f2e9d9ee0059768c2c18d9d39d57cc304 (patch)
tree51dd2ba88bcaa8d10df9b1fc5f6822f06c5aab3f /src
parentbcb0e04bf2fdd5cf8c9bd9ed44ee75180aca2f22 (diff)
downloadopenttd-d798766f2e9d9ee0059768c2c18d9d39d57cc304.tar.xz
(svn r25539) -Codechange: Setup object GUI matrix before restoring selected object, so that the matrix state can be properly set. (sbr)
Diffstat (limited to 'src')
-rw-r--r--src/object_gui.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/object_gui.cpp b/src/object_gui.cpp
index 8e687b836..4c1a47aa6 100644
--- a/src/object_gui.cpp
+++ b/src/object_gui.cpp
@@ -81,6 +81,10 @@ public:
this->vscroll->SetPosition(0);
this->vscroll->SetCount(ObjectClass::GetUIClassCount());
+ NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
+ matrix->SetScrollbar(this->GetScrollbar(WID_BO_SELECT_SCROLL));
+ matrix->SetCount(ObjectClass::Get(_selected_object_class)->GetUISpecCount());
+
if (this->CanRestoreSelectedObject()) {
this->SelectOtherObject(_selected_object_index);
} else {
@@ -90,10 +94,6 @@ public:
this->EnsureSelectedObjectClassIsVisible();
this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4);
- NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
- matrix->SetScrollbar(this->GetScrollbar(WID_BO_SELECT_SCROLL));
- matrix->SetCount(ObjectClass::Get(_selected_object_class)->GetUISpecCount());
-
/* If needed restore the window previous size with the stored values.*/
uint default_num_cols = this->GetMatrixColumnCount();
uint default_num_rows = this->vscroll->GetCapacity();
@@ -106,8 +106,6 @@ public:
* matrix columns are visible. */
this->FindWindowPlacementAndResize(this->width, this->height);
}
-
- if (_selected_object_index != -1) matrix->SetClicked(ObjectClass::Get(_selected_object_class)->GetUIFromIndex(_selected_object_index));
}
virtual ~BuildObjectWindow()
@@ -424,6 +422,7 @@ public:
const ObjectSpec *spec = objclass->GetSpec(i);
if (spec->IsAvailable()) {
_selected_object_class = j;
+ this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX)->SetCount(ObjectClass::Get(_selected_object_class)->GetUISpecCount());
this->SelectOtherObject(i);
return;
}