From 4b801f1f50e0ca78d92673e92f9f05f22514f2d7 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 25 Feb 2021 22:20:26 +0100 Subject: planner: split createTemporaryPlan() function. The DivePlannerPointsModel::createTemporaryPlan() function had two distinct and independent parts: 1) create the data points. 2) create the dive sample and calculate variations. The second part was only exectuted if the recalc flag was set. Out of the two callers, one was explicitly disabling and setting the recalc flag to avoid the second part. The much more logical thing is to simply split the function in two and only call the first part. To avoid any functional change, the second caller (the profile) still tests for the recalc flag. However, if it shouldn't replot a new plan, why calculate it in the first place!? And why does the display function change the plan at all? This appears all very ill-thought out and should be changed in due course. Signed-off-by: Berthold Stoeger --- profile-widget/profilewidget2.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'profile-widget/profilewidget2.cpp') diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index d5cae62a4..d0c58c8ab 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -543,6 +543,7 @@ void ProfileWidget2::plotDive(const struct dive *dIn, int dcIn, bool force, bool #ifndef SUBSURFACE_MOBILE } else { plannerModel->createTemporaryPlan(); + plannerModel->recalcTemporaryPlan(); struct diveplan &diveplan = plannerModel->getDiveplan(); if (!diveplan.dp) { plannerModel->deleteTemporaryPlan(); -- cgit v1.2.3-70-g09d2