diff --git a/game/ato/flight.py b/game/ato/flight.py index ebfd6d2c..e69d872c 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -171,6 +171,15 @@ class Flight(SidcDescribable): def missing_pilots(self) -> int: return self.roster.missing_pilots + def set_flight_type(self, var: FlightType) -> None: + self.flight_type = var + + # Update _flight_plan_builder so that the builder class remains relevant + # to the flight type + from .flightplans.flightplanbuildertypes import FlightPlanBuilderTypes + + self._flight_plan_builder = FlightPlanBuilderTypes.for_flight(self)(self) + def return_pilots_and_aircraft(self) -> None: self.roster.clear() self.squadron.claim_inventory(-self.count) diff --git a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py index 38395dad..bd521062 100644 --- a/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py +++ b/qt_ui/windows/mission/flight/waypoints/QFlightWaypointTab.py @@ -162,11 +162,11 @@ class QFlightWaypointTab(QFrame): ) original_task = self.flight.flight_type if result == QMessageBox.Yes: - self.flight.flight_type = task + self.flight.set_flight_type(task) try: self.flight.recreate_flight_plan() except PlanningError as ex: - self.flight.flight_type = original_task + self.flight.set_flight_type(original_task) logging.exception("Could not recreate flight") QMessageBox.critical( self, "Could not recreate flight", str(ex), QMessageBox.Ok