summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-11-20 19:52:17 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-20 11:21:48 -0800
commitf6b29d093f51508312846c8dcf7e1f9e104d0796 (patch)
tree2a8e2514519fe1905671e2ae38ad7ecfdeabc2d9 /dive.c
parent51345e4ad828918a4e20b6aba40c3b0a137b1e73 (diff)
downloadsubsurface-f6b29d093f51508312846c8dcf7e1f9e104d0796.tar.gz
Use get_cylinder_index in per_cylinder_mean_depth
Use get_cylinder_index that handles SAMPLE_EVENT_GASCHANGE and SAMPLE_EVENT_GASCHANGE2. This also removes the need for a special case where get_gasidx returns -1, because get_cylinder_index always returns the "closest" gas that it finds. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/dive.c b/dive.c
index 269aeb658..8ce1c950f 100644
--- a/dive.c
+++ b/dive.c
@@ -361,11 +361,7 @@ void per_cylinder_mean_depth(struct dive *dive, struct divecomputer *dc, int *me
int time = sample->time.seconds;
int depth = sample->depth.mm;
if (ev && time >= ev->time.seconds) {
- int o2 = (ev->value & 0xFFFF) * 10;
- int he = (ev->value >> 16) * 10;
- int tank = get_gasidx(dive, o2, he);
- if (tank >= 0)
- idx = tank; // should never happen unless the input file is inconsistent
+ idx = get_cylinder_index(dive, ev);
ev = get_next_event(ev->next, "gaschange");
}
/* We ignore segments at the surface */