diff options
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/core/dive.c b/core/dive.c index e6b27e0bb..b8162edd0 100644 --- a/core/dive.c +++ b/core/dive.c @@ -4234,10 +4234,22 @@ static void delete_divecomputer(struct dive *d, int num) invalidate_dive_cache(d); } -/* always acts on the current dive */ -void delete_current_divecomputer(void) +/* Clone a dive and delete goven dive computer */ +struct dive *clone_delete_divecomputer(const struct dive *d, int dc_number) { - delete_divecomputer(current_dive, dc_number); + struct dive *res; + + /* copy the dive */ + res = alloc_dive(); + copy_dive(d, res); + + /* make a new unique id, since we still can't handle two equal ids */ + res->id = dive_getUniqID(); + invalidate_dive_cache(res); + + delete_divecomputer(res, dc_number); + + return res; } /* |