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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-25 22:20:26 +01:00 committed by Dirk Hohndel
parent 7b9c8e344a
commit 4b801f1f50
3 changed files with 27 additions and 22 deletions

View file

@ -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();