Fix dual pane purchase window with mixed wagon/loco variant trees

Use top-level variant engine for the loco/wagon categorisation

See: #558
pull/562/head
Jonathan G Rennison 12 months ago
parent 5415b596b0
commit d55ba23a87

@ -2607,7 +2607,12 @@ struct BuildVehicleWindowTrainAdvanced final : BuildVehicleWindowBase {
if (!FilterSingleEngine(state, eid)) continue;
if ((rvi->railveh_type == RAILVEH_WAGON) != wagon) continue;
const Engine *top_engine = engine;
for (int depth = 0; depth < 16; depth++) {
if (top_engine->info.variant_id == INVALID_ENGINE) break;
top_engine = Engine::Get(top_engine->info.variant_id);
}
if ((top_engine->u.rail.railveh_type == RAILVEH_WAGON) != wagon) continue;
/* Filter by name or NewGRF extra text */
if (!FilterByText(state, engine)) continue;

Loading…
Cancel
Save