mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
When editing a manually added dive, correctly update max depth
The fixup_dive() function assumes that values that are set already in the divecomputer and dive structures come from a reliable source - sometimes dive computers are able to track a maximum depth continuously, so that value can be larger than the deepest sample and we need to honor that. But in the case of a manually added dive, the samples define the dive. So in this case we need to reset the values that were calculated when the dive was first added so that the user can then edit the dive and reduce the maximum depth reached in the profile and have that reflected in the dive list. Fixes #926 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
30f81949a0
commit
c41810e5a5
1 changed files with 3 additions and 0 deletions
|
@ -1155,6 +1155,9 @@ void MainTab::acceptChanges()
|
|||
find_new_trip_start_time(current_dive->divetrip);
|
||||
}
|
||||
if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) {
|
||||
// we just added or edited the dive, let fixup_dive() make
|
||||
// sure we get the max depth right
|
||||
current_dive->maxdepth.mm = current_dc->maxdepth.mm = 0;
|
||||
fixup_dive(current_dive);
|
||||
set_dive_nr_for_current_dive();
|
||||
MainWindow::instance()->showProfile();
|
||||
|
|
Loading…
Reference in a new issue