From 6d0ac603f2bdd0ccec2e3d4a1419e8671a493bcb Mon Sep 17 00:00:00 2001 From: Raffson Date: Sun, 1 Jan 2023 16:53:58 +0100 Subject: [PATCH] Generate packages according to TOT order (latest first, earliest last) This makes sure that aircraft spawning in the air due to a shortage of parking spots, will have the earliest TOT possible. Flights with later TOTs should be generated first so that they remain at the airfield as OCA target. --- game/missiongenerator/aircraft/aircraftgenerator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/missiongenerator/aircraft/aircraftgenerator.py b/game/missiongenerator/aircraft/aircraftgenerator.py index 876667ef..1b8d1084 100644 --- a/game/missiongenerator/aircraft/aircraftgenerator.py +++ b/game/missiongenerator/aircraft/aircraftgenerator.py @@ -104,7 +104,7 @@ class AircraftGenerator: ato: The ATO to spawn aircraft for. dynamic_runways: Runway data for carriers and FARPs. """ - for package in ato.packages: + for package in reversed(sorted(ato.packages, key=lambda x: x.time_over_target)): if not package.flights: continue for flight in package.flights: