Make TOT waypoints non-optional for flight plans.

Flights without a meaningful TOT make the code around startup time (and
other scheduling behaviors) unnecessarily complicated because they have
to handle unpredictable flight plans. We can simplify this by requiring
that all flight plans have a waypoint associated with their TOT. For
custom flight plans, we can just fall back to the takeoff waypoint. For
RTB flight plans (which are only synthetic flight plans injected for
aborted flights), we can use the abort point.

This also means that all flight plans now have, at the very least, a
departure waypoint. Deleting this waypoint is invalid even for custom
flights, so that's no a problem.
This commit is contained in:
Dan Albert
2022-09-02 20:54:41 -07:00
parent 4f1e3da70a
commit 452848fd2a
11 changed files with 33 additions and 24 deletions

View File

@@ -148,7 +148,12 @@ class QFlightWaypointTab(QFrame):
if not isinstance(self.flight.flight_plan, CustomFlightPlan):
self.flight.flight_plan = CustomFlightPlan(
self.flight,
CustomLayout(custom_waypoints=self.flight.flight_plan.waypoints),
CustomLayout(
departure=WaypointBuilder(self.flight, self.coalition).takeoff(
self.flight.departure
),
custom_waypoints=self.flight.flight_plan.waypoints[1:],
),
)
def confirm_recreate(self, task: FlightType) -> None: