mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Import: pass a dive table to process_imported_dives()
Dives were directly imported into the global dive table and then merged in process_imported_dives(). Make this interface more flexible, by passing an independent dive table. The dive table of the to-be-imported dives will be sorted and merged. Then each dive is inserted in a one-by-one manner to into the global dive table. This actually introduces (at least) two functional changes: 1) If a new dive spans two old dives, it will only be merged to the first dive. But this seems like a pathological case, which is of dubious value anyway. 2) Dives unrelated to the import will not be merged. The old code would happily merge dives that were not even close to the newly imported dives. A surprising behavior. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c32e71e64d
commit
810903bdb9
9 changed files with 203 additions and 111 deletions
|
@ -163,21 +163,17 @@ void DiveImportedModel::recordDives()
|
|||
// nothing to do, just exit
|
||||
return;
|
||||
|
||||
// walk the table of imported dives and record the ones that the user picked
|
||||
// clearing out the table as we go
|
||||
for (int i = 0; i < rowCount(); i++) {
|
||||
struct dive *d = diveTable->dives[i];
|
||||
if (d && checkStates[i]) {
|
||||
record_dive(d);
|
||||
} else {
|
||||
// we should free the dives that weren't recorded
|
||||
clear_dive(d);
|
||||
free(d);
|
||||
}
|
||||
diveTable->dives[i] = NULL;
|
||||
// delete non-selected dives
|
||||
int total = diveTable->nr;
|
||||
int j = 0;
|
||||
for (int i = 0; i < total; i++) {
|
||||
if (checkStates[i])
|
||||
j++;
|
||||
else
|
||||
delete_dive_from_table(&downloadTable, j);
|
||||
}
|
||||
diveTable->nr = 0;
|
||||
process_imported_dives(true);
|
||||
|
||||
process_imported_dives(diveTable, true);
|
||||
if (autogroup)
|
||||
autogroup_dives();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue