From 661bdae2e5c0924613c080a3ac44f172e9061471 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Mon, 15 Jan 2024 22:12:55 +0100 Subject: [PATCH] Fix #11785, cf16f45: when bumping aircraft into the air, remove them from the loading vehicle list again --- src/saveload/vehicle_sl.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp index 8d482a1b89..cbec457e2d 100644 --- a/src/saveload/vehicle_sl.cpp +++ b/src/saveload/vehicle_sl.cpp @@ -198,6 +198,18 @@ void UpdateOldAircraft() SetAircraftPosition(a, gp.x, gp.y, GetAircraftFlightLevel(a)); } } + + /* Clear aircraft from loading vehicles, if we bumped them into the air. */ + for (Station *st : Station::Iterate()) { + for (auto iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); /* nothing */) { + Vehicle *v = *iter; + if (v->type == VEH_AIRCRAFT && !v->current_order.IsType(OT_LOADING)) { + iter = st->loading_vehicles.erase(iter); + } else { + ++iter; + } + } + } } /**