mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-10 00:11:31 +00:00
(svn r24175) -Fix (r24171): Make sure to select a object class with visible objects when opening the object GUI.
This commit is contained in:
parent
aa0ce945c4
commit
6baef585cf
@ -47,6 +47,7 @@ public:
|
|||||||
this->FinishInitNested(desc, 0);
|
this->FinishInitNested(desc, 0);
|
||||||
|
|
||||||
this->SelectFirstAvailableObject(true);
|
this->SelectFirstAvailableObject(true);
|
||||||
|
assert(ObjectClass::Get(_selected_object_class)->GetUISpecCount() > 0); // object GUI should be disables elsewise
|
||||||
this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4);
|
this->GetWidget<NWidgetMatrix>(WID_BO_OBJECT_MATRIX)->SetCount(4);
|
||||||
|
|
||||||
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
|
NWidgetMatrix *matrix = this->GetWidget<NWidgetMatrix>(WID_BO_SELECT_MATRIX);
|
||||||
@ -354,7 +355,16 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* If all objects are unavailable, select nothing. */
|
/* If all objects are unavailable, select nothing... */
|
||||||
|
if (ObjectClass::Get(_selected_object_class)->GetUISpecCount() == 0) {
|
||||||
|
/* ... but make sure that the class is not empty. */
|
||||||
|
for (ObjectClassID j = OBJECT_CLASS_BEGIN; j < OBJECT_CLASS_MAX; j++) {
|
||||||
|
if (ObjectClass::Get(j)->GetUISpecCount() > 0) {
|
||||||
|
_selected_object_class = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
this->SelectOtherObject(-1);
|
this->SelectOtherObject(-1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user