From d8d89f4ccbdbdd25e1330fe4aa78013a20e57f72 Mon Sep 17 00:00:00 2001 From: pleroy Date: Sat, 26 Oct 2024 15:59:18 +0200 Subject: [PATCH] We have a utility for that. --- ksp_plugin/interface_planetarium.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ksp_plugin/interface_planetarium.cpp b/ksp_plugin/interface_planetarium.cpp index eb5420106a..1ab5a06ac2 100644 --- a/ksp_plugin/interface_planetarium.cpp +++ b/ksp_plugin/interface_planetarium.cpp @@ -345,16 +345,13 @@ void __cdecl principia__PlanetariumPlotCelestialFutureTrajectory( *minimal_distance_from_camera = std::numeric_limits::infinity(); return m.Return(); } else { - auto& vessel = *plugin->GetVessel(vessel_guid); + auto const& vessel = *plugin->GetVessel(vessel_guid); Instant const prediction_final_time = vessel.prediction()->t_max(); - Instant final_time; - if (vessel.has_flight_plan()) { - vessel.ReadFlightPlanFromMessage(); - final_time = std::max(vessel.flight_plan().actual_final_time(), - prediction_final_time); - } else { - final_time = prediction_final_time; - } + Instant const final_time = + vessel.has_flight_plan() + ? std::max(vessel.flight_plan().actual_final_time(), + prediction_final_time) + : prediction_final_time; auto const& celestial_trajectory = plugin->GetCelestial(celestial_index).trajectory(); // No need to request reanimation here because the current time of the