From 325c4459ade70f626d6a39fecfb9e0c27f0c5cee Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 30 Sep 2017 15:21:26 +0300 Subject: 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 --- core/dive.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') 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; } /* -- cgit v1.2.3-70-g09d2