mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
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>
This commit is contained in:
parent
ffc3e598fa
commit
8bc4233add
1 changed files with 4 additions and 2 deletions
|
@ -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 get_gasmix_from_event(const struct dive *dive, const struct event *ev)
|
||||||
{
|
{
|
||||||
struct gasmix dummy = gasmix_air;
|
|
||||||
if (ev && event_is_gaschange(ev)) {
|
if (ev && event_is_gaschange(ev)) {
|
||||||
int index = ev->gas.index;
|
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)
|
if (index >= 0 && index < dive->cylinders.nr)
|
||||||
return get_cylinder(dive, index)->gasmix;
|
return get_cylinder(dive, index)->gasmix;
|
||||||
return ev->gas.mix;
|
return ev->gas.mix;
|
||||||
}
|
}
|
||||||
return dummy;
|
return gasmix_air;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we need this to be uniq. oh, and it has no meaning whatsoever
|
// we need this to be uniq. oh, and it has no meaning whatsoever
|
||||||
|
|
Loading…
Reference in a new issue