mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Fix cases where pilots were not returned.
https://github.com/dcs-liberation/dcs_liberation/issues/276
This commit is contained in:
parent
5277beede3
commit
8b8e018521
@ -387,6 +387,8 @@ class Game:
|
|||||||
# Update statistics
|
# Update statistics
|
||||||
self.game_stats.update(self)
|
self.game_stats.update(self)
|
||||||
|
|
||||||
|
self.blue_air_wing.reset()
|
||||||
|
self.red_air_wing.reset()
|
||||||
self.aircraft_inventory.reset()
|
self.aircraft_inventory.reset()
|
||||||
for cp in self.theater.controlpoints:
|
for cp in self.theater.controlpoints:
|
||||||
self.aircraft_inventory.set_from_control_point(cp)
|
self.aircraft_inventory.set_from_control_point(cp)
|
||||||
|
|||||||
@ -78,7 +78,7 @@ class Squadron:
|
|||||||
self.available_pilots.extend(new_pilots)
|
self.available_pilots.extend(new_pilots)
|
||||||
|
|
||||||
def return_all_pilots(self) -> None:
|
def return_all_pilots(self) -> None:
|
||||||
self.available_pilots = self.pilots
|
self.available_pilots = list(self.pilots)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def faker(self) -> Faker:
|
def faker(self) -> Faker:
|
||||||
@ -152,6 +152,10 @@ class AirWing:
|
|||||||
def squadron_at_index(self, index: int) -> Squadron:
|
def squadron_at_index(self, index: int) -> Squadron:
|
||||||
return list(self.iter_squadrons())[index]
|
return list(self.iter_squadrons())[index]
|
||||||
|
|
||||||
|
def reset(self) -> None:
|
||||||
|
for squadron in self.iter_squadrons():
|
||||||
|
squadron.return_all_pilots()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def size(self) -> int:
|
def size(self) -> int:
|
||||||
return sum(len(s) for s in self.squadrons.values())
|
return sum(len(s) for s in self.squadrons.values())
|
||||||
|
|||||||
@ -529,6 +529,7 @@ class PendingTransfers:
|
|||||||
flight = transport.flight
|
flight = transport.flight
|
||||||
flight.package.remove_flight(flight)
|
flight.package.remove_flight(flight)
|
||||||
self.game.aircraft_inventory.return_from_flight(flight)
|
self.game.aircraft_inventory.return_from_flight(flight)
|
||||||
|
flight.clear_roster()
|
||||||
|
|
||||||
@cancel_transport.register
|
@cancel_transport.register
|
||||||
def _cancel_transport_convoy(
|
def _cancel_transport_convoy(
|
||||||
|
|||||||
@ -257,6 +257,7 @@ class PackageBuilder:
|
|||||||
flights = list(self.package.flights)
|
flights = list(self.package.flights)
|
||||||
for flight in flights:
|
for flight in flights:
|
||||||
self.global_inventory.return_from_flight(flight)
|
self.global_inventory.return_from_flight(flight)
|
||||||
|
flight.clear_roster()
|
||||||
self.package.remove_flight(flight)
|
self.package.remove_flight(flight)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -284,6 +284,9 @@ class Flight:
|
|||||||
def missing_pilots(self) -> int:
|
def missing_pilots(self) -> int:
|
||||||
return len([p for p in self.pilots if p is None])
|
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):
|
def __repr__(self):
|
||||||
name = db.unit_type_name(self.unit_type)
|
name = db.unit_type_name(self.unit_type)
|
||||||
if self.custom_name:
|
if self.custom_name:
|
||||||
|
|||||||
@ -167,6 +167,7 @@ class PackageModel(QAbstractListModel):
|
|||||||
if flight.cargo is not None:
|
if flight.cargo is not None:
|
||||||
flight.cargo.transport = None
|
flight.cargo.transport = None
|
||||||
self.game_model.game.aircraft_inventory.return_from_flight(flight)
|
self.game_model.game.aircraft_inventory.return_from_flight(flight)
|
||||||
|
flight.clear_roster()
|
||||||
self.package.remove_flight(flight)
|
self.package.remove_flight(flight)
|
||||||
self.endRemoveRows()
|
self.endRemoveRows()
|
||||||
self.update_tot()
|
self.update_tot()
|
||||||
@ -259,6 +260,7 @@ class AtoModel(QAbstractListModel):
|
|||||||
self.ato.remove_package(package)
|
self.ato.remove_package(package)
|
||||||
for flight in package.flights:
|
for flight in package.flights:
|
||||||
self.game.aircraft_inventory.return_from_flight(flight)
|
self.game.aircraft_inventory.return_from_flight(flight)
|
||||||
|
flight.clear_roster()
|
||||||
if flight.cargo is not None:
|
if flight.cargo is not None:
|
||||||
flight.cargo.transport = None
|
flight.cargo.transport = None
|
||||||
self.endRemoveRows()
|
self.endRemoveRows()
|
||||||
|
|||||||
@ -239,6 +239,7 @@ class QNewPackageDialog(QPackageDialog):
|
|||||||
super().on_cancel()
|
super().on_cancel()
|
||||||
for flight in self.package_model.package.flights:
|
for flight in self.package_model.package.flights:
|
||||||
self.game.aircraft_inventory.return_from_flight(flight)
|
self.game.aircraft_inventory.return_from_flight(flight)
|
||||||
|
flight.clear_roster()
|
||||||
|
|
||||||
|
|
||||||
class QEditPackageDialog(QPackageDialog):
|
class QEditPackageDialog(QPackageDialog):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user