From 5f02febb6c0603148ee72ec00d33e31ff60e8409 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 23 Oct 2020 22:41:28 -0700 Subject: [PATCH] Fix kneeboard crash for small strike missions. When we don't coalesce target points on the kneeboard we call add_waypoint_row multiple times, so calls after the first were using the travel time from one strike target to the next. Since they were so close that rounded down to zero and caused a divide by zero error. Update the last waypoint in add_waypoint instead. --- gen/kneeboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen/kneeboard.py b/gen/kneeboard.py index d2782188..9cf9b258 100644 --- a/gen/kneeboard.py +++ b/gen/kneeboard.py @@ -124,6 +124,7 @@ class FlightPlanBuilder: self.target_points = [] self.add_waypoint_row(NumberedWaypoint(waypoint_num, waypoint)) + self.last_waypoint = waypoint def coalesce_target_points(self) -> None: if len(self.target_points) <= 4: @@ -155,7 +156,6 @@ class FlightPlanBuilder: self._format_time(waypoint.waypoint.tot), self._format_time(waypoint.waypoint.departure_time), ]) - self.last_waypoint = waypoint.waypoint def _format_time(self, time: Optional[int]) -> str: if time is None: