core: move fixup_dive() to struct dive_table

This accesses the global dive_table, so make this explicit.

Since force_fixup_dive() and default_dive() use fixup_dive(),
also move them to struct dive_table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-23 14:20:59 +02:00 committed by bstoeger
parent d81ca005ab
commit a2903b31a7
12 changed files with 233 additions and 228 deletions

View file

@ -1358,7 +1358,7 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
d->meandepth.mm = d->dcs[0].meandepth.mm = 0;
fake_dc(&d->dcs[0]);
}
fixup_dive(d);
divelog.dives.fixup_dive(*d);
Command::editDive(orig, d_ptr.release(), dsChange.createdDs.release(), dsChange.editDs, dsChange.location); // With release() we're giving up ownership
changesNeedSaving();
}
@ -1717,7 +1717,7 @@ int QMLManager::addDive()
{
// we do NOT save the modified data at this stage because of the UI flow here... this will
// be saved once the user finishes editing the newly added dive
auto d = dive::default_dive();
auto d = divelog.dives.default_dive();
int diveId = d->id;
Command::addDive(std::move(d), divelog.autogroup, true);