mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
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>
This commit is contained in:
parent
5440d0c39f
commit
327ea3aca4
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue