From 376c1137d7b5465d2e673d0e4785f9f5689f76c2 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Sat, 21 Oct 2023 15:28:26 -0700 Subject: [PATCH] Fix stale waypoint tasks for custom flight plans. Fixes https://github.com/dcs-liberation/dcs_liberation/issues/3189. --- game/ato/flight.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/game/ato/flight.py b/game/ato/flight.py index f2fe4424..86942f4b 100644 --- a/game/ato/flight.py +++ b/game/ato/flight.py @@ -97,6 +97,13 @@ class Flight(SidcDescribable): self._flight_plan_builder = CustomBuilder(self, self.flight_plan.waypoints[1:]) self.recreate_flight_plan() + # We need to clear the existing actions/options when moving the waypoints into + # the new flight plan because the actions/options that are currently set will be + # the actions of whatever flight plan was previously used. + # https://github.com/dcs-liberation/dcs_liberation/issues/3189 + for waypoint in self.flight_plan.iter_waypoints(): + waypoint.actions.clear() + waypoint.options.clear() def __getstate__(self) -> dict[str, Any]: state = self.__dict__.copy()