summaryrefslogtreecommitdiffstats
path: root/core/divelist.c
diff options
context:
space:
mode:
authorGravatar Willem Ferguson <willemferguson@zoology.up.ac.za>2018-04-07 17:52:16 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-14 23:47:00 +0300
commitcad4eb39c4ac0a46dbaab6932e9319704eb90e6d (patch)
treec9b1ff2298a5b4ec9684ee5b338f1e7110a66b12 /core/divelist.c
parentb9174332d562b8b9c436a94880c51acf2c5ab761 (diff)
downloadsubsurface-cad4eb39c4ac0a46dbaab6932e9319704eb90e6d.tar.gz
Implement get_divemode() to find the divemode at a particular time
Replaced a rather cumbersome function that that did the above. Upon the suggestion of Robert Helling who proposed a much shorter way, this new function replaced the previous ones. This necessitated changes to divelist.c, profile.c and plannernotes.c, as well as dive.c/h. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Diffstat (limited to 'core/divelist.c')
-rw-r--r--core/divelist.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/divelist.c b/core/divelist.c
index d70130b31..acac8ec6b 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -414,9 +414,9 @@ static void add_dive_to_deco(struct deco_state *ds, struct dive *dive)
{
struct divecomputer *dc = &dive->dc;
struct gasmix *gasmix = NULL;
- struct event *ev = NULL;
- struct event *ev_dmc = dc->events, *ev_dmt = get_next_divemodechange(&ev_dmc, TRUE);
int i;
+ struct event *ev = NULL, *evd = NULL;
+ enum dive_comp_type current_divemode = UNDEF_COMP_TYPE;
if (!dc)
return;
@@ -432,7 +432,7 @@ static void add_dive_to_deco(struct deco_state *ds, struct dive *dive)
int depth = interpolate(psample->depth.mm, sample->depth.mm, j - t0, t1 - t0);
gasmix = get_gasmix(dive, dc, j, &ev, gasmix);
add_segment(ds, depth_to_bar(depth, dive), gasmix, 1, sample->setpoint.mbar,
- get_divemode_at_time(dc, j, &ev_dmt), dive->sac);
+ get_current_divemode(&dive->dc, j, &evd, &current_divemode), dive->sac);
}
}
}