From c127a92e8e4544b793fd5b8f2548ab3e646818c9 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Thu, 5 Oct 2017 20:04:07 +0200 Subject: 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 --- core/dive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/dive.c') 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; -- cgit v1.2.3-70-g09d2