mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: fix calculations of variations
In 8704a8b6f9 the code in
cloneDiveplan() was replaced by a simple assignement statement.
Alas, the original code was more complex: it copied only up
to a certain point (it stopped at automatically generated
steps).
The new behavior made the calculations of variations fail.
Therefore, readd a function that copies a dive plan, but
"forgets" the automatically added stops.
Fixes #4368
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
beb352d47c
commit
69d1be999a
3 changed files with 16 additions and 2 deletions
|
|
@ -74,6 +74,17 @@ diveplan::~diveplan()
|
|||
{
|
||||
}
|
||||
|
||||
diveplan diveplan::copy_planned_segments() const
|
||||
{
|
||||
diveplan res = *this;
|
||||
|
||||
// Remove non manually added entries
|
||||
auto it = std::find_if(res.dp.begin(), res.dp.end(),
|
||||
[] (const divedatapoint &dp) { return dp.time && !dp.entered; });
|
||||
res.dp.erase(it, res.dp.end());
|
||||
return res;
|
||||
}
|
||||
|
||||
bool diveplan::is_empty() const
|
||||
{
|
||||
return std::none_of(dp.begin(), dp.end(), [](const divedatapoint &dp) { return dp.time != 0; });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue