summaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-01 00:56:44 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2020-05-01 12:36:28 +0200
commit8bc4233add0a70a647e53a557b9c87146b8294f8 (patch)
treeec22d8527ea9bbf7b63a48656d755f76797aba37 /core/dive.c
parentffc3e598faa5d986d78e9a275c48193a3a835cfe (diff)
downloadsubsurface-8bc4233add0a70a647e53a557b9c87146b8294f8.tar.gz
profile: return air for one-past last cylinder
This is the code for "surface air". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/dive.c b/core/dive.c
index b4fa22d24..c95bc6a95 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -339,14 +339,16 @@ enum divemode_t get_current_divemode(const struct divecomputer *dc, int time, co
struct gasmix get_gasmix_from_event(const struct dive *dive, const struct event *ev)
{
- struct gasmix dummy = gasmix_air;
if (ev && event_is_gaschange(ev)) {
int index = ev->gas.index;
+ // FIXME: The planner uses one past cylinder-count to signify "surface air". Remove in due course.
+ if (index == dive->cylinders.nr)
+ return gasmix_air;
if (index >= 0 && index < dive->cylinders.nr)
return get_cylinder(dive, index)->gasmix;
return ev->gas.mix;
}
- return dummy;
+ return gasmix_air;
}
// we need this to be uniq. oh, and it has no meaning whatsoever