mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Handle scenaio where flight that is not added to the ATO (flight in the process of being created) is deleted (#3512)
This commit is contained in:
parent
7b1c84d347
commit
bcdd9e1807
@ -174,10 +174,15 @@ class PackageModel(QAbstractListModel):
|
||||
EventStream.put_nowait(GameUpdateEvents().update_flight(flight))
|
||||
# If there are no more flights in the package, delete the package.
|
||||
if len(self.package.flights) == 0:
|
||||
# Check if package is in ATO first as flight may still be "tentative" i.e.
|
||||
# not added to the ATO yet.
|
||||
if flight.package in flight.squadron.coalition.ato.packages:
|
||||
flight.squadron.coalition.ato.remove_package(flight.package)
|
||||
# Update ATO model so packages list is refreshed.
|
||||
is_player = flight.squadron.coalition.player
|
||||
self.game_model.ato_model_for(is_player).replace_from_game(is_player)
|
||||
self.game_model.ato_model_for(is_player).replace_from_game(
|
||||
is_player
|
||||
)
|
||||
|
||||
def delete_flight(self, flight: Flight) -> None:
|
||||
"""Removes the given flight from the package."""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user