Fix cases where pilots were not returned.

https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
Dan Albert
2021-05-26 18:49:19 -07:00
parent 5277beede3
commit 8b8e018521
7 changed files with 15 additions and 1 deletions

View File

@@ -257,6 +257,7 @@ class PackageBuilder:
flights = list(self.package.flights)
for flight in flights:
self.global_inventory.return_from_flight(flight)
flight.clear_roster()
self.package.remove_flight(flight)

View File

@@ -284,6 +284,9 @@ class Flight:
def missing_pilots(self) -> int:
return len([p for p in self.pilots if p is None])
def clear_roster(self) -> None:
self.squadron.return_pilots([p for p in self.pilots if p is not None])
def __repr__(self):
name = db.unit_type_name(self.unit_type)
if self.custom_name: