summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 23:09:12 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 23:09:12 -0700
commit5bc5cae6dcdb6a48bb5077d01e490bebedc624d9 (patch)
tree69323c0f826995c45558937d062e3f0a2d369527 /dive.c
parent88f39912603f9ce3d7c799b65580ee30e5ccb364 (diff)
downloadsubsurface-5bc5cae6dcdb6a48bb5077d01e490bebedc624d9.tar.gz
Planner: only copy cylinders that were used in the template dive
This was only semi-implemented the first time around. Now we really only copy the ones that are indeed used. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/dive.c b/dive.c
index 145a01883..00c08ed2d 100644
--- a/dive.c
+++ b/dive.c
@@ -308,13 +308,16 @@ int nr_weightsystems(struct dive *dive)
return nr;
}
-void copy_cylinders(struct dive *s, struct dive *d)
+void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
{
int i;
if (!s || !d)
return;
for (i = 0; i < MAX_CYLINDERS; i++)
- d->cylinder[i] = s->cylinder[i];
+ if (!used_only || cylinder_is_used(s, &s->cylinder[i]))
+ d->cylinder[i] = s->cylinder[i];
+ else
+ memset(&d->cylinder[i], 0, sizeof(cylinder_t));
}
void copy_samples(struct dive *s, struct dive *d)