Fix #10763, Fix #11168: Display variant groups that consist only of unavailable sub-groups (#11342)

This commit is contained in:
merni-ns
2023-10-03 18:13:15 +05:30
committed by GitHub
parent 5869f790d8
commit c794676928
2 changed files with 21 additions and 3 deletions

View File

@@ -179,7 +179,13 @@ class ReplaceVehicleWindow : public Window {
if (side == 1 && eid == this->sel_engine[0]) flags |= EngineDisplayFlags::Shaded;
list.emplace_back(eid, e->info.variant_id, flags, 0);
if (side == 1 && e->info.variant_id != INVALID_ENGINE) variants.push_back(e->info.variant_id);
if (side == 1) {
EngineID parent = e->info.variant_id;
while (parent != INVALID_ENGINE) {
variants.push_back(parent);
parent = Engine::Get(parent)->info.variant_id;
}
}
if (eid == this->sel_engine[side]) selected_engine = eid; // The selected engine is still in the list
}