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

@@ -387,6 +387,8 @@ class Game:
# Update statistics
self.game_stats.update(self)
self.blue_air_wing.reset()
self.red_air_wing.reset()
self.aircraft_inventory.reset()
for cp in self.theater.controlpoints:
self.aircraft_inventory.set_from_control_point(cp)

View File

@@ -78,7 +78,7 @@ class Squadron:
self.available_pilots.extend(new_pilots)
def return_all_pilots(self) -> None:
self.available_pilots = self.pilots
self.available_pilots = list(self.pilots)
@property
def faker(self) -> Faker:
@@ -152,6 +152,10 @@ class AirWing:
def squadron_at_index(self, index: int) -> Squadron:
return list(self.iter_squadrons())[index]
def reset(self) -> None:
for squadron in self.iter_squadrons():
squadron.return_all_pilots()
@property
def size(self) -> int:
return sum(len(s) for s in self.squadrons.values())

View File

@@ -529,6 +529,7 @@ class PendingTransfers:
flight = transport.flight
flight.package.remove_flight(flight)
self.game.aircraft_inventory.return_from_flight(flight)
flight.clear_roster()
@cancel_transport.register
def _cancel_transport_convoy(