diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-07-15 20:29:14 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-15 20:29:14 -0700 |
commit | 327ea3aca4ca5ced8593f702de4f68603a8dad22 (patch) | |
tree | 9f8f64d2ba3964aecdd274d96c04cbeffc818144 | |
parent | 5440d0c39fd844b013a98e9c2b1bece6ef8b0c41 (diff) | |
download | subsurface-327ea3aca4ca5ced8593f702de4f68603a8dad22.tar.gz |
Dive equipment edit - fix logic for applying changes
We keep getting this wrong. First you check all selected dives that are
not the current dive, make sure the equipment was the same before the edit
and then apply the changes. Then, when you are done with ALL of them, then
you change the current dive. Otherwise you cannot compare to the 'before'
state anymore.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-ui/maintab.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 2e5aaf086..eef8fdd6b 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -693,11 +693,11 @@ void MainTab::acceptChanges() if (same_string(mydive->cylinder[i].type.description, cd->cylinder[i].type.description)) // only copy the cylinder type, none of the other values mydive->cylinder[i].type = displayed_dive.cylinder[i].type; - } else { - mydive->cylinder[i] = displayed_dive.cylinder[i]; } } ); + for (int i = 0; i < MAX_CYLINDERS; i++) + cd->cylinder[i] = displayed_dive.cylinder[i]; MainWindow::instance()->graphics()->replot(); } @@ -705,10 +705,12 @@ void MainTab::acceptChanges() mark_divelist_changed(true); MODIFY_SELECTED_DIVES( for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) { - if (same_string(mydive->weightsystem[i].description, cd->weightsystem[i].description)) + if (mydive != cd && same_string(mydive->weightsystem[i].description, cd->weightsystem[i].description)) mydive->weightsystem[i] = displayed_dive.weightsystem[i]; } ); + for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) + cd->weightsystem[i] = displayed_dive.weightsystem[i]; } // each dive that was selected might have had the temperatures in its active divecomputer changed // so re-populate the temperatures - easiest way to do this is by calling fixup_dive |