summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2015-01-25 12:28:06 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-25 07:23:27 -0800
commit58173d711c29b1f913e4264c2ed689e5553e035b (patch)
tree7e7074a39e83836bb3a57efa4550ad1c412351df /divelist.c
parent6b3e361e904cd7e7f5b4be025cede2db2d2a12ce (diff)
downloadsubsurface-58173d711c29b1f913e4264c2ed689e5553e035b.tar.gz
Have get_dive_gas return air when without cylinders
If we called get_dive_gas on a dive without cylinders, we returned 100%, which is quite wrong. This makes us return air as default gas instead. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/divelist.c b/divelist.c
index ba11f02c1..f1dd7006c 100644
--- a/divelist.c
+++ b/divelist.c
@@ -134,7 +134,8 @@ void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2max_p)
mino2 = o2;
}
/* All air? Show/sort as "air"/zero */
- if (!maxhe && maxo2 == O2_IN_AIR && mino2 == maxo2)
+ if ((!maxhe && maxo2 == O2_IN_AIR && mino2 == maxo2) ||
+ (maxo2 == -1 && maxhe == -1 && mino2 == 1000))
maxo2 = mino2 = 0;
*o2_p = mino2;
*he_p = maxhe;