Remove flights with package not in ATO in migrator

This commit is contained in:
Raffson 2023-09-24 22:14:26 +02:00
parent e8929467e0
commit d581af3b8a
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99

View File

@ -99,12 +99,18 @@ class Migrator:
try_set_attr(layout, "nav_from", [])
def _update_flights(self) -> None:
to_remove = []
for f in self.game.db.flights.objects.values():
try_set_attr(f, "frequency")
try_set_attr(f, "tacan")
try_set_attr(f, "tcn_name")
try_set_attr(f, "fuel", f.unit_type.max_fuel)
self._update_flight_plan(f)
if f.package in f.squadron.coalition.ato.packages:
self._update_flight_plan(f)
else:
to_remove.append(f.id)
for fid in to_remove:
self.game.db.flights.remove(fid)
def _release_untasked_flights(self) -> None:
for cp in self.game.theater.controlpoints: