summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-15 13:13:01 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-15 13:16:03 -0700
commitd681bdcb63081d45495ffd3bb17c1bfa52ab98fa (patch)
tree02761cc752a55156e39ec2891f09bfe2d0fb5075 /libdivecomputer.c
parent6ba140571e2fdb1514fff27430a82e6f96ed83b8 (diff)
downloadsubsurface-d681bdcb63081d45495ffd3bb17c1bfa52ab98fa.tar.gz
Only use default cylinder for first one
When downloading from a divecomputer it makes little sense to assume that all tanks are the default cylinder. There's a good case to be made for having a default first cylinder (you always dive with your own cylinder, or you are always on a dive boat with AL80 tanks), but in multi-cylinder situations this is much more likely to cause unintended harm; for example for those dive computers that always report their maximum number of cylinders, even if some of them aren't used. Here setting a default cylinder turns those entries from obviously empty into something that appears to have meaning (i.e., cylinder type is filled in) even though this was just a default added by Subsurface. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 309605e56..c0c8e0bbb 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -124,7 +124,9 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
dive->cylinder[i].gasmix.o2.permille = o2;
dive->cylinder[i].gasmix.he.permille = he;
- if (!get_tanksize(devdata, data, dive->cylinder, i))
+ /* for the first tank, if there is no tanksize available from the
+ * dive computer, fill in the default tank information (if set) */
+ if (i == 0 && !get_tanksize(devdata, data, dive->cylinder, i))
fill_default_cylinder(&dive->cylinder[i]);
}
return DC_STATUS_SUCCESS;