aboutsummaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-10-04 00:07:59 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-10-05 12:59:02 -0700
commitb3f5473b66b8210d1276f197876e0e2d7bbd6fa7 (patch)
treeda74045c259a1bb3eff989f8a647568054f1ae79 /core/dive.c
parent6729428b6a942f83892129d7b8d1e5ef04930d05 (diff)
downloadsubsurface-b3f5473b66b8210d1276f197876e0e2d7bbd6fa7.tar.gz
core: don't merge sample-derived pressures in merge_one_cylinder()
These will be recalculated from the pressures in fixup_dive() anyway. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/core/dive.c b/core/dive.c
index 2c9de41a3..0658d73bc 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -2276,15 +2276,12 @@ static void merge_one_cylinder(cylinder_t *a, const cylinder_t *b)
/* If either cylinder has manually entered pressures, try to merge them.
* Use pressures from divecomputer samples if only one cylinder has such a value.
- * Yes, this is an actual use case we encountered. */
+ * Yes, this is an actual use case we encountered.
+ * Note that we don't merge the sample-derived pressure values, as this is
+ * perfomed after merging in fixup_dive() */
a->start = merge_pressures(a->start, a->sample_start, b->start, b->sample_start, false);
a->end = merge_pressures(a->end, a->sample_end, b->end, b->sample_end, true);
- 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;
-
/* Really? */
a->gas_used.mliter += b->gas_used.mliter;
a->deco_gas_used.mliter += b->deco_gas_used.mliter;