diff options
author | Robert C. Helling <helling@atdotde.de> | 2018-07-02 21:12:44 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-03 14:47:15 -0700 |
commit | 8697f7a84d988155e13079e32a7dd00fe418ee42 (patch) | |
tree | 47dc69080c8d6f041ac0b6ad445c177bb552526c /core/dive.c | |
parent | 57c01f7a66ccd04fc2e83b67a840519db4661798 (diff) | |
download | subsurface-8697f7a84d988155e13079e32a7dd00fe418ee42.tar.gz |
Include cylinder pressures upon force_fixup()
Try to recompute cylinder start and end pressures from sample
data.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/dive.c b/core/dive.c index 0936f685f..2840e864f 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3385,6 +3385,8 @@ static void force_fixup_dive(struct dive *d) int old_mintemp = d->mintemp.mkelvin; int old_maxtemp = d->maxtemp.mkelvin; duration_t old_duration = d->duration; + cylinder_t old_cylinders[MAX_CYLINDERS]; + memcpy(old_cylinders, &d->cylinder, MAX_CYLINDERS * sizeof(cylinder_t)); d->maxdepth.mm = 0; dc->maxdepth.mm = 0; @@ -3393,6 +3395,10 @@ static void force_fixup_dive(struct dive *d) d->duration.seconds = 0; d->maxtemp.mkelvin = 0; d->mintemp.mkelvin = 0; + for (int i = 0; i < MAX_CYLINDERS; i++) { + d->cylinder[i].start.mbar = 0; + d->cylinder[i].end.mbar = 0; + } fixup_dive(d); @@ -3410,6 +3416,12 @@ static void force_fixup_dive(struct dive *d) if (!d->duration.seconds) d->duration = old_duration; + for (int i = 0; i < MAX_CYLINDERS; i++) { + if (!d->cylinder[i].start.mbar) + d->cylinder[i].start = old_cylinders[i].start; + if (!d->cylinder[i].end.mbar) + d->cylinder[i].end = old_cylinders[i].end; + } } |