diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-11 07:49:19 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-11 10:48:14 +0100 |
commit | 8514ec8723542b11a555af2d204a4a7b66b062cc (patch) | |
tree | f4217ee9f8254a9c87a021ed989e5088c59873da /main.c | |
parent | cda1b73bf68d1802c32416bce3be0ef84137002e (diff) | |
download | subsurface-8514ec8723542b11a555af2d204a4a7b66b062cc.tar.gz |
Support merging of two adjacent dives
This introduces the notion of merging two disjoint dives: you can select
two dives from the dive list, and if the selection is exactly two dives,
and they are adjacent (and share the same dive trip), we support the
notion of merging the dives into one dive.
The most common reason for this is an extended surface event, which made
the dive computer decide that the dive was ended, but maybe you were
just waiting for a buddy or a student at the surface, and you want to
stitch together two dives into one.
There are still details to be sorted out: my Suunto dive computers don't
actually do surface samples at the beginning or end of the dive, so when
you stitch two dives together, the profile ends up being this odd "a
couple of feet under water between the two parts of the dive" thing.
But that's an independent thing from the actual merging logic, and I'll
work on that separately.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -138,14 +138,12 @@ void report_dives(gboolean is_imported) /* careful - we might free the dive that last points to. Oops... */ if (last == prev || last == dive) last = merged; - free(prev); - free(dive); - *pp = merged; - dive_table.nr--; - memmove(pp+1, pp+2, sizeof(*pp)*(dive_table.nr - i)); /* Redo the new 'i'th dive */ i--; + add_single_dive(i, merged); + delete_single_dive(i+1); + delete_single_dive(i+1); } if (is_imported) { |