Prevent creating empty ferry packages.

An empty squadron or a fully-assigned squadron won't have anything to
assign to the ferry mission.

Fixes https://github.com/dcs-liberation/dcs_liberation/issues/1588
This commit is contained in:
Dan Albert 2021-09-01 19:19:57 -07:00
parent 16d397db1c
commit 2c8f960696

View File

@ -369,9 +369,12 @@ class Squadron:
raise RuntimeError(
f"Cannot plan ferry flights for {self} because there is no destination."
)
remaining = self.untasked_aircraft
if not remaining:
return
package = Package(self.destination)
builder = FlightPlanBuilder(package, self.coalition, theater)
remaining = self.untasked_aircraft
while remaining:
size = min(remaining, self.aircraft.max_group_size)
self.plan_ferry_flight(builder, package, size)