From 327ea3aca4ca5ced8593f702de4f68603a8dad22 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 15 Jul 2014 20:29:14 -0700 Subject: 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 --- qt-ui/maintab.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'qt-ui/maintab.cpp') 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 -- cgit v1.2.3-70-g09d2