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

@ -2,6 +2,8 @@
#include "command_event.h"
#include "core/dive.h"
#include "core/divelist.h"
#include "core/divelog.h"
#include "core/selection.h"
#include "core/subsurface-qt/divelistnotifier.h"
#include "core/libdivecomputer.h"
@ -145,7 +147,7 @@ void RemoveEvent::post() const
if (cylinder < 0)
return;
fixup_dive(d);
divelog.dives.fixup_dive(*d);
emit diveListNotifier.cylinderEdited(d, cylinder);
// TODO: This is silly we send a DURATION change event so that the statistics are recalculated.
@ -199,7 +201,7 @@ void AddGasSwitch::redoit()
eventsToRemove = std::move(newEventsToRemove);
// this means we potentially have a new tank that is being used and needs to be shown
fixup_dive(d);
divelog.dives.fixup_dive(*d);
for (int idx: cylinders)
emit diveListNotifier.cylinderEdited(d, idx);