summaryrefslogtreecommitdiffstats
path: root/core/planner.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-06 11:28:47 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-08-08 16:26:31 -0700
commitff40afc1d86789c988d6bce33af9995646f0e963 (patch)
treefa9205c7a68edf63535119aacd6816c20830578a /core/planner.c
parent90ea46ff31d924e90401d0300260a67a83d417a7 (diff)
downloadsubsurface-ff40afc1d86789c988d6bce33af9995646f0e963.tar.gz
Planner: pass dive to analyze_gaslist()
Use the actual planned dive, not the displayed dive in analyze_gaslist(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/planner.c')
-rw-r--r--core/planner.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/planner.c b/core/planner.c
index deacab6f5..dd7c98ca6 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -406,12 +406,12 @@ struct gaschanges {
int gasidx;
};
-static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, int *gaschangenr, int depth, int *asc_cylinder)
+static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, struct dive *dive, int *gaschangenr, int depth, int *asc_cylinder)
{
int nr = 0;
struct gaschanges *gaschanges = NULL;
struct divedatapoint *dp = diveplan->dp;
- int best_depth = displayed_dive.cylinder[*asc_cylinder].depth.mm;
+ int best_depth = dive->cylinder[*asc_cylinder].depth.mm;
bool total_time_zero = true;
while (dp) {
if (dp->time == 0 && total_time_zero) {
@@ -446,7 +446,7 @@ static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, int *gascha
for (nr = 0; nr < *gaschangenr; nr++) {
int idx = gaschanges[nr].gasidx;
printf("gaschange nr %d: @ %5.2lfm gasidx %d (%s)\n", nr, gaschanges[nr].depth / 1000.0,
- idx, gasname(&displayed_dive.cylinder[idx].gasmix));
+ idx, gasname(dive->cylinder[idx].gasmix));
}
#endif
return gaschanges;
@@ -762,7 +762,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
gaschanges = NULL;
gaschangenr = 0;
} else {
- gaschanges = analyze_gaslist(diveplan, &gaschangenr, depth, &best_first_ascend_cylinder);
+ gaschanges = analyze_gaslist(diveplan, dive, &gaschangenr, depth, &best_first_ascend_cylinder);
}
/* Find the first potential decostopdepth above current depth */
for (stopidx = 0; stopidx < decostoplevelcount; stopidx++)