From ee49d559c38423a184725ee5ffb457bd11e4e0bf Mon Sep 17 00:00:00 2001 From: simu_poppo Date: Wed, 3 Jun 2026 16:31:22 +0900 Subject: [PATCH] BUG FIX: airplane invalid reservation during loading --- vehicle/simvehicle.cc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/vehicle/simvehicle.cc b/vehicle/simvehicle.cc index 14a9f41f61..cea788e659 100644 --- a/vehicle/simvehicle.cc +++ b/vehicle/simvehicle.cc @@ -5544,7 +5544,9 @@ bool air_vehicle_t::block_reserver( uint32 start, uint32 end, bool reserve ) con // un-reserve if not successful if( !success && reserve ) { - for( uint32 i=start; ilookup(route->at(i)); if (gr) { runway_t* sch1 = (runway_t *)gr->get_weg(air_wt); @@ -5570,6 +5572,22 @@ bool air_vehicle_t::block_reserver( uint32 start, uint32 end, bool reserve ) con } } + // When unreserving the takeoff section (end < touchdown), the landing runway + // tiles were never visited by the main loop, so their load-balancing + // reservations added during the original takeoff must be removed here. + if( !reserve && endget_count(); i++ ) { + if( grund_t *gr = welt->lookup(route->at(i)) ) { + if( runway_t* sch1 = (runway_t *)gr->get_weg(air_wt) ) { + if( sch1->get_desc()->get_styp()!=type_runway ) { + break; + } + sch1->remove_convoi_reservation( cnv->self ); + } + } + } + } + return success; } @@ -5835,6 +5853,15 @@ void air_vehicle_t::set_convoi(convoi_t *c) } } } + // Airborne during final approach: the plane is not on a runway tile so the + // runway-tile guard above does not fire, but the landing runway reservation + // was already acquired at the approach trigger before saving and must be + // restored now. Calling block_reserver twice (when route_index==touchdown-1 + // already handled above) is harmless — reserve() is idempotent for the same + // convoy handle. + if( state==landing && route_index