summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2014-05-20 14:01:40 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-20 14:16:00 +0900
commit7821b879837cae62a5e9e8ecf1071656852eb371 (patch)
tree06fd6ef6801a1c0014148a5e348f97920ebf8c75 /dive.c
parent176d49c59173b2fb01e3d596f56365b904bfa99d (diff)
downloadsubsurface-7821b879837cae62a5e9e8ecf1071656852eb371.tar.gz
Use the last 'diveid' when merging dives for one dive computer
When we merge two dives into the same dive because a divecomputer had incorrectly considered it two separate dives (due to surface time within the dive) we should pick the dive ID from the later dive to be the diveid of the resulting merged dive. Otherwise we might re-download the (now merged) partial dive. This is a rather unusual special case, but it actually hit me with the Uemis on my last dive in Palau: Chandelier Cave has multiple surface points where you can spend time admiring the cave above water, and the Uemis (but not my Suunto's) decided that the dive was actually four short dives back-to-back. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index cc673f122..d9943c23f 100644
--- a/dive.c
+++ b/dive.c
@@ -1926,6 +1926,9 @@ static void interleave_dive_computers(struct divecomputer *res,
if (match) {
merge_events(res, a, match, offset);
merge_samples(res, a, match, offset);
+ /* Use the diveid of the later dive! */
+ if (offset > 0)
+ res->diveid = match->diveid;
} else {
res->sample = a->sample;
res->samples = a->samples;