mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move clone_delete_divecomputer() to struct dive_table
Since this calls force_fixup_dive() it needs access to other dives in the dive_table. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
576d3a3bc6
commit
79bf79ad7f
5 changed files with 25 additions and 26 deletions
|
@ -12,7 +12,6 @@
|
|||
#include "libdivecomputer.h"
|
||||
#include "device.h"
|
||||
#include "divelist.h"
|
||||
#include "divelog.h"
|
||||
#include "divesite.h"
|
||||
#include "equipment.h"
|
||||
#include "errorhelper.h"
|
||||
|
@ -2332,7 +2331,6 @@ void set_informational_units(const char *units)
|
|||
if (strstr(units, "MINUTES"))
|
||||
git_prefs.units.vertical_speed_time = units::MINUTES;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* clones a dive and moves given dive computer to front */
|
||||
|
@ -2350,28 +2348,6 @@ std::unique_ptr<dive> clone_make_first_dc(const struct dive &d, int dc_number)
|
|||
return res;
|
||||
}
|
||||
|
||||
/* Clone a dive and delete given dive computer */
|
||||
std::unique_ptr<dive> clone_delete_divecomputer(const struct dive &d, int dc_number)
|
||||
{
|
||||
/* copy the dive */
|
||||
auto res = std::make_unique<dive>(d);
|
||||
|
||||
/* make a new unique id, since we still can't handle two equal ids */
|
||||
res->id = dive_getUniqID();
|
||||
|
||||
if (res->dcs.size() <= 1)
|
||||
return res;
|
||||
|
||||
if (dc_number < 0 || static_cast<size_t>(dc_number) >= res->dcs.size())
|
||||
return res;
|
||||
|
||||
res->dcs.erase(res->dcs.begin() + dc_number);
|
||||
|
||||
divelog.dives.force_fixup_dive(*res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//Calculate O2 in best mix
|
||||
fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue