diff --git a/core/planner.c b/core/planner.c index 244a8e16b..75e3e4027 100644 --- a/core/planner.c +++ b/core/planner.c @@ -339,7 +339,7 @@ void free_dps(struct diveplan *diveplan) diveplan->dp = NULL; } -struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2) +static struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2) { struct divedatapoint *dp; diff --git a/core/planner.h b/core/planner.h index 48d2bb33f..127f51fa8 100644 --- a/core/planner.h +++ b/core/planner.h @@ -51,7 +51,6 @@ extern char *get_planner_disclaimer_formatted(); extern void free_dps(struct diveplan *diveplan); struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode); -struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2); #if DEBUG_PLAN void dump_plan(struct diveplan *diveplan); #endif diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index fcf510f23..fd6e0ebfc 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -1025,6 +1025,14 @@ void DivePlannerPointsModel::createTemporaryPlan() { // Get the user-input and calculate the dive info free_dps(&diveplan); + + for (int i = 0; i < d->cylinders.nr; i++) { + cylinder_t *cyl = get_cylinder(d, i); + if (cyl->depth.mm && cyl->cylinder_use == OC_GAS) { + plan_add_segment(&diveplan, 0, cyl->depth.mm, i, 0, false, OC); + } + } + int lastIndex = -1; for (int i = 0; i < rowCount(); i++) { divedatapoint p = at(i); @@ -1039,20 +1047,6 @@ void DivePlannerPointsModel::createTemporaryPlan() plan_add_segment(&diveplan, deltaT, p.depth.mm, p.cylinderid, p.setpoint, true, p.divemode); } - struct divedatapoint *dp = NULL; - for (int i = 0; i < d->cylinders.nr; i++) { - cylinder_t *cyl = get_cylinder(d, i); - if (cyl->depth.mm && cyl->cylinder_use == OC_GAS) { - dp = create_dp(0, cyl->depth.mm, i, 0); - if (diveplan.dp) { - dp->next = diveplan.dp; - diveplan.dp = dp; - } else { - dp->next = NULL; - diveplan.dp = dp; - } - } - } #if DEBUG_PLAN dump_plan(&diveplan); #endif