mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 19:36:15 +00:00
planner: remove cloneDivePlan()
This was a trivial one-liner and is not needed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3e006e678a
commit
22b232661a
2 changed files with 5 additions and 11 deletions
|
@ -1128,7 +1128,7 @@ void DivePlannerPointsModel::updateDiveProfile()
|
||||||
if (isPlanner() && shouldComputeVariations()) {
|
if (isPlanner() && shouldComputeVariations()) {
|
||||||
auto plan_copy = std::make_unique<struct diveplan>();
|
auto plan_copy = std::make_unique<struct diveplan>();
|
||||||
lock_planner();
|
lock_planner();
|
||||||
cloneDiveplan(diveplan, *plan_copy);
|
*plan_copy = diveplan;
|
||||||
unlock_planner();
|
unlock_planner();
|
||||||
#ifdef VARIATIONS_IN_BACKGROUND
|
#ifdef VARIATIONS_IN_BACKGROUND
|
||||||
// Since we're calling computeVariations asynchronously and plan_deco_state is allocated
|
// Since we're calling computeVariations asynchronously and plan_deco_state is allocated
|
||||||
|
@ -1177,11 +1177,6 @@ void DivePlannerPointsModel::saveDuplicatePlan()
|
||||||
createPlan(true);
|
createPlan(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::cloneDiveplan(const struct diveplan &plan_src, struct diveplan &plan_copy)
|
|
||||||
{
|
|
||||||
plan_copy = plan_src;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DivePlannerPointsModel::analyzeVariations(const std::vector<decostop> &min, const std::vector<decostop> &mid, const std::vector<decostop> &max, const char *unit)
|
int DivePlannerPointsModel::analyzeVariations(const std::vector<decostop> &min, const std::vector<decostop> &mid, const std::vector<decostop> &max, const char *unit)
|
||||||
{
|
{
|
||||||
auto sum_time = [](int time, const decostop &ds) { return ds.time + time; };
|
auto sum_time = [](int time, const decostop &ds) { return ds.time + time; };
|
||||||
|
@ -1243,7 +1238,7 @@ void DivePlannerPointsModel::computeVariations(std::unique_ptr<struct diveplan>
|
||||||
depth_units = tr("ft");
|
depth_units = tr("ft");
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneDiveplan(*original_plan, plan_copy);
|
plan_copy = *original_plan;
|
||||||
if (plan_copy.dp.size() < 2)
|
if (plan_copy.dp.size() < 2)
|
||||||
return;
|
return;
|
||||||
if (my_instance != instanceCounter)
|
if (my_instance != instanceCounter)
|
||||||
|
@ -1251,7 +1246,7 @@ void DivePlannerPointsModel::computeVariations(std::unique_ptr<struct diveplan>
|
||||||
plan(&ds, plan_copy, dive.get(), dcNr, 1, original, cache, true, false);
|
plan(&ds, plan_copy, dive.get(), dcNr, 1, original, cache, true, false);
|
||||||
save.restore(&ds, false);
|
save.restore(&ds, false);
|
||||||
|
|
||||||
cloneDiveplan(*original_plan, plan_copy);
|
plan_copy = *original_plan;
|
||||||
second_to_last(plan_copy.dp).depth.mm += delta_depth.mm;
|
second_to_last(plan_copy.dp).depth.mm += delta_depth.mm;
|
||||||
plan_copy.dp.back().depth.mm += delta_depth.mm;
|
plan_copy.dp.back().depth.mm += delta_depth.mm;
|
||||||
if (my_instance != instanceCounter)
|
if (my_instance != instanceCounter)
|
||||||
|
@ -1266,7 +1261,7 @@ void DivePlannerPointsModel::computeVariations(std::unique_ptr<struct diveplan>
|
||||||
plan(&ds, plan_copy, dive.get(), dcNr, 1, shallower, cache, true, false);
|
plan(&ds, plan_copy, dive.get(), dcNr, 1, shallower, cache, true, false);
|
||||||
save.restore(&ds, false);
|
save.restore(&ds, false);
|
||||||
|
|
||||||
cloneDiveplan(*original_plan, plan_copy);
|
plan_copy = *original_plan;
|
||||||
plan_copy.dp.back().time += delta_time.seconds;
|
plan_copy.dp.back().time += delta_time.seconds;
|
||||||
if (my_instance != instanceCounter)
|
if (my_instance != instanceCounter)
|
||||||
return;
|
return;
|
||||||
|
@ -1322,7 +1317,7 @@ void DivePlannerPointsModel::createPlan(bool saveAsNew)
|
||||||
if (shouldComputeVariations()) {
|
if (shouldComputeVariations()) {
|
||||||
auto plan_copy = std::make_unique<struct diveplan>();
|
auto plan_copy = std::make_unique<struct diveplan>();
|
||||||
lock_planner();
|
lock_planner();
|
||||||
cloneDiveplan(diveplan, *plan_copy);
|
*plan_copy = diveplan;
|
||||||
unlock_planner();
|
unlock_planner();
|
||||||
computeVariations(std::move(plan_copy), &ds_after_previous_dives);
|
computeVariations(std::move(plan_copy), &ds_after_previous_dives);
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,6 @@ private:
|
||||||
void updateDiveProfile(); // Creates a temporary plan and updates the dive profile with it.
|
void updateDiveProfile(); // Creates a temporary plan and updates the dive profile with it.
|
||||||
void createTemporaryPlan();
|
void createTemporaryPlan();
|
||||||
struct diveplan diveplan;
|
struct diveplan diveplan;
|
||||||
void cloneDiveplan(const struct diveplan &plan_src, struct diveplan &plan_copy);
|
|
||||||
void computeVariationsDone(QString text);
|
void computeVariationsDone(QString text);
|
||||||
void computeVariations(std::unique_ptr<struct diveplan> plan, const struct deco_state *ds);
|
void computeVariations(std::unique_ptr<struct diveplan> plan, const struct deco_state *ds);
|
||||||
void computeVariationsFreeDeco(std::unique_ptr<struct diveplan> plan, std::unique_ptr<struct deco_state> ds);
|
void computeVariationsFreeDeco(std::unique_ptr<struct diveplan> plan, std::unique_ptr<struct deco_state> ds);
|
||||||
|
|
Loading…
Add table
Reference in a new issue