diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2017-09-30 15:21:26 +0300 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-10-01 11:31:18 +0300 |
commit | 325c4459ade70f626d6a39fecfb9e0c27f0c5cee (patch) | |
tree | 6f9510b3674c66696e3bcfefc2ce0d68bab33b8c /core | |
parent | 571918feaa85fb5dc8ec0cc0c15fcc12d8e155c5 (diff) | |
download | subsurface-325c4459ade70f626d6a39fecfb9e0c27f0c5cee.tar.gz |
Update sample_start and sample_end pressures
When we merge dives, the sample_start and sample_end pressures are only
used in-memory for displaying data to the user. However, we should
update them as well as this will show the user the correct data in the
equipment/cylinder and i.e. SAC calculation.
Fixes #577
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/dive.c b/core/dive.c index 0b0cbd671..8cec50407 100644 --- a/core/dive.c +++ b/core/dive.c @@ -2155,6 +2155,11 @@ static void merge_one_cylinder(cylinder_t *a, cylinder_t *b) a->start.mbar = b->start.mbar; if (!a->end.mbar) a->end.mbar = b->end.mbar; + + if (a->sample_start.mbar && b->sample_start.mbar) + a->sample_start.mbar = a->sample_start.mbar > b->sample_start.mbar ? a->sample_start.mbar : b->sample_start.mbar; + if (a->sample_end.mbar && b->sample_end.mbar) + a->sample_end.mbar = a->sample_end.mbar < b->sample_end.mbar ? a->sample_end.mbar : b->sample_end.mbar; } /* |