mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: add dive site table parameter to dive site functions
To enable undo of dive site functions, it is crucial to work with different dive site tables. Therefore add a dive site table parameter to dive site functions. For now, always pass the global dive site table. Thus, this commit shouldn't alter any functionality. After this change, a simple search for dive_site_table reveals all places where the global dive site table is accessed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
36644dc9f7
commit
f6e7bdc5ef
22 changed files with 118 additions and 118 deletions
|
@ -993,7 +993,7 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
|
|||
} else if (!is_log && dive && !strcmp(tag, "divespot_id")) {
|
||||
int divespot_id = atoi(val);
|
||||
if (divespot_id != -1) {
|
||||
struct dive_site *ds = create_dive_site("from Uemis", dive->when);
|
||||
struct dive_site *ds = create_dive_site("from Uemis", dive->when, &dive_site_table);
|
||||
dive->dive_site = ds;
|
||||
uemis_mark_divelocation(dive->dc.diveid, divespot_id, ds);
|
||||
}
|
||||
|
@ -1191,11 +1191,11 @@ static void get_uemis_divespot(const char *mountpath, int divespot_id, struct di
|
|||
* we search all existing divesites if we have one with the same name already. The function
|
||||
* returns the first found which is luckily not the newly created.
|
||||
*/
|
||||
ods = get_dive_site_by_name(nds->name);
|
||||
ods = get_dive_site_by_name(nds->name, &dive_site_table);
|
||||
if (ods) {
|
||||
/* if the uuid's are the same, the new site is a duplicate and can be deleted */
|
||||
if (nds->uuid != ods->uuid) {
|
||||
delete_dive_site(nds);
|
||||
delete_dive_site(nds, &dive_site_table);
|
||||
dive->dive_site = ods;
|
||||
}
|
||||
}
|
||||
|
@ -1204,7 +1204,7 @@ static void get_uemis_divespot(const char *mountpath, int divespot_id, struct di
|
|||
/* if we can't load the dive site details, delete the site we
|
||||
* created in process_raw_buffer
|
||||
*/
|
||||
delete_dive_site(dive->dive_site);
|
||||
delete_dive_site(dive->dive_site, &dive_site_table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue