core: move split_dive*() functions to struct dive_table

These functions have to access other dives in the list to
calculate CNS, etc, so let's call them from there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-24 19:17:43 +02:00 committed by bstoeger
parent a2903b31a7
commit 8ec1f008ab
5 changed files with 217 additions and 216 deletions

View file

@ -833,9 +833,9 @@ static std::array<std::unique_ptr<dive>, 2> doSplitDives(const dive *d, duration
{
// Split the dive
if (time.seconds < 0)
return split_dive(*d);
return divelog.dives.split_dive(*d);
else
return split_dive_at_time(*d, time);
return divelog.dives.split_dive_at_time(*d, time);
}
SplitDives::SplitDives(dive *d, duration_t time) : SplitDivesBase(d, doSplitDives(d, time))
@ -844,7 +844,7 @@ SplitDives::SplitDives(dive *d, duration_t time) : SplitDivesBase(d, doSplitDive
}
SplitDiveComputer::SplitDiveComputer(dive *d, int dc_num) :
SplitDivesBase(d, split_divecomputer(*d, dc_num))
SplitDivesBase(d, divelog.dives.split_divecomputer(*d, dc_num))
{
setText(Command::Base::tr("split dive computer"));
}