summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-10-05 20:04:07 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2017-10-05 20:32:35 +0200
commitc127a92e8e4544b793fd5b8f2548ab3e646818c9 (patch)
treed11961d05a536aeb4f7adf360909eca49000b369 /core
parent3487612337ef0308e3f2129a3193a0f65ac9691c (diff)
downloadsubsurface-c127a92e8e4544b793fd5b8f2548ab3e646818c9.tar.gz
Explicitly copy a cylinder which was marked as "unused" in the planner
When planning a new dive (not replan!!!) based on an existing (planned) dive, the cylinders from the existing selected dive are copied. This patch guarantees that cylinders which had been marked as "unused" are indeed copied as well. Sounds strange at the first moment but makes sense because if one marks a cylinder explicitly as "unused" in the planner instead of deleting it that does mean that one wants to keep this cylinder to have it available and be able to reenable it later-on. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core')
-rw-r--r--core/dive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c
index 8cec50407..84d476958 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -670,7 +670,7 @@ void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
memset(&d->cylinder[i], 0, sizeof(cylinder_t));
}
for (i = j = 0; i < MAX_CYLINDERS; i++) {
- if (!used_only || is_cylinder_used(s, i)) {
+ if (!used_only || is_cylinder_used(s, i) || s->cylinder[i].cylinder_use == NOT_USED) {
d->cylinder[j].type = s->cylinder[i].type;
d->cylinder[j].type.description = copy_string(s->cylinder[i].type.description);
d->cylinder[j].gasmix = s->cylinder[i].gasmix;