mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge the dive sites selected.
Wee. :) Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e36e4d1faa
commit
1ef20ee5d8
3 changed files with 22 additions and 3 deletions
21
divesite.c
21
divesite.c
|
@ -1,6 +1,7 @@
|
|||
/* divesite.c */
|
||||
#include "divesite.h"
|
||||
#include "dive.h"
|
||||
#include "divelist.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
@ -276,9 +277,27 @@ void clear_dive_site(struct dive_site *ds)
|
|||
free_taxonomy(&ds->taxonomy);
|
||||
}
|
||||
|
||||
void merge_dive_sites(uint32_t* uuids, int count)
|
||||
void merge_dive_sites(uint32_t ref, uint32_t* uuids, int count)
|
||||
{
|
||||
int curr_dive, i;
|
||||
struct dive *d;
|
||||
for(i = 0; i < count; i++){
|
||||
if (uuids[i] == ref)
|
||||
continue;
|
||||
|
||||
for_each_dive(curr_dive, d) {
|
||||
if (d->dive_site_uuid != uuids[i] )
|
||||
continue;
|
||||
d->dive_site_uuid = ref;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
if (uuids[i] == ref)
|
||||
continue;
|
||||
delete_dive_site(uuids[i]);
|
||||
}
|
||||
mark_divelist_changed(true);
|
||||
}
|
||||
|
||||
uint32_t find_or_create_dive_site_with_name(const char *name, timestamp_t divetime)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue