1
0
Fork 0
mirror of https://github.com/subsurface/subsurface.git synced 2025-02-19 22:16:15 +00:00

planner: call removeDeco() explicitly

removeDeco() was called by addStop() if the recalc flag was
set. If the caller didn't want to call removeDeco() it had
to clear and restore the flag.

Instead, call removeDeco() explicitly when needed.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-02-27 22:34:08 +01:00 committed by Dirk Hohndel
parent c7dcd7fbf0
commit f0f3b4a13c

View file

@ -61,6 +61,7 @@ void DivePlannerPointsModel::createSimpleDive(struct dive *dIn)
d->dc.model = strdup("planned dive"); // don't translate! this is stored in the XML file
clear();
removeDeco();
setupCylinders();
setupStartTime();
@ -119,6 +120,7 @@ void DivePlannerPointsModel::loadFromDive(dive *dIn)
duration_t newtime = {};
clear();
removeDeco();
free_dps(&diveplan);
diveplan.when = d->when;
@ -748,11 +750,13 @@ int DivePlannerPointsModel::lastEnteredPoint() const
void DivePlannerPointsModel::addDefaultStop()
{
removeDeco();
addStop(0, 0, -1, 0, true, UNDEF_COMP_TYPE);
}
void DivePlannerPointsModel::addStop(int milimeters, int seconds)
{
removeDeco();
addStop(milimeters, seconds, -1, 0, true, UNDEF_COMP_TYPE);
updateDiveProfile();
}
@ -767,8 +771,6 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
cylinderid = cylinderid_in;
else
usePrevious = true;
if (recalc)
removeDeco();
int row = divepoints.count();
if (seconds == 0 && milimeters == 0 && row != 0) {