summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-05 16:28:40 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-10-06 00:01:09 +0100
commitc378df81ab670206c376145b00d9e6694f3786ab (patch)
tree2d1071daf503578ae6d2cdc5a12d614770b05da9 /divelist.c
parentcb112f9ac5574b35832d53521c6208fe7e9c5fa7 (diff)
downloadsubsurface-c378df81ab670206c376145b00d9e6694f3786ab.tar.gz
Mark divelist as changed even if imported dives got merged
The number of dives didn't go up, but we have one (or more) additional dive computers added to an existing dive. Fixes #936 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c
index 86117422f..a14fabf88 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1026,6 +1026,7 @@ void process_dives(bool is_imported, bool prefer_imported)
{
int i;
int preexisting = dive_table.preexisting;
+ bool did_merge = false;
struct dive *last;
/* check if we need a nickname for the divecomputer for newly downloaded dives;
@@ -1077,6 +1078,9 @@ void process_dives(bool is_imported, bool prefer_imported)
delete_single_dive(i + 1);
// keep the id or the first dive for the merged dive
merged->id = id;
+
+ /* this means the table was changed */
+ did_merge = true;
}
/* make sure no dives are still marked as downloaded */
for (i = 1; i < dive_table.nr; i++)
@@ -1087,9 +1091,10 @@ void process_dives(bool is_imported, bool prefer_imported)
if (!last || last->number)
try_to_renumber(last, preexisting);
- /* did we add dives to the dive table? */
- if (preexisting != dive_table.nr)
+ /* did we add dives or divecomputers to the dive table? */
+ if (did_merge || preexisting < dive_table.nr) {
mark_divelist_changed(true);
+ }
}
}