Avoid generating/planning flights without an operational runway

This commit is contained in:
Raffson 2023-04-10 14:38:06 +02:00
parent 7eb652b970
commit efd2c40cfc
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
2 changed files with 10 additions and 1 deletions

View File

@ -108,10 +108,17 @@ class AircraftGenerator:
self._reserve_frequencies_and_tacan(ato)
for package in reversed(sorted(ato.packages, key=lambda x: x.time_over_target)):
logging.info(f"Generating package for target: {package.target.name}")
if not package.flights:
continue
for flight in package.flights:
if flight.alive:
if not flight.squadron.location.runway_is_operational():
logging.warning(
f"Runway not operational, skipping flight: {flight.flight_type}"
)
flight.return_pilots_and_aircraft()
continue
logging.info(f"Generating flight: {flight.unit_type}")
group = self.create_and_configure_flight(
flight, country, dynamic_runways

View File

@ -48,7 +48,9 @@ class SquadronSelector(QComboBox):
return
for squadron in self.air_wing.squadrons_for(aircraft):
if task in squadron.mission_types and squadron.untasked_aircraft:
valid_task = task in squadron.mission_types
runway_operational = squadron.location.runway_is_operational()
if valid_task and squadron.untasked_aircraft and runway_operational:
self.addItem(f"{squadron.location}: {squadron}", squadron)
if self.count() == 0: