mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
fix: merge_pressure does not calculate starting pressures correctly
The existing logic correctly calculates the minimum (ie, ending) pressure, but not the maximum (ie starting) pressure. For example, 2 tanks A and B with manual pressures (same tank on subsequent dives, which were then merged): A: 205 - 84 B: 83 - 55 When merging the starting pressures, the call is : merge_pressure(205, 0, 83, 0, false) The final comparison is: if(false && 205 < 83) return 205; else return 83; -> So 83 is returned even though 205 should have been. Signed-off-by: Michael Werle <micha@michaelwerle.com>
This commit is contained in:
parent
26f20b805d
commit
fae68b7a68
1 changed files with 3 additions and 4 deletions
|
@ -1852,10 +1852,9 @@ static pressure_t merge_pressures(pressure_t a, pressure_t sample_a, pressure_t
|
|||
a = b;
|
||||
if (!b.mbar)
|
||||
b = a;
|
||||
if (take_min && a.mbar < b.mbar)
|
||||
return a;
|
||||
else
|
||||
return b;
|
||||
if (take_min)
|
||||
return a.mbar < b.mbar? a : b;
|
||||
return a.mbar > b.mbar? a : b;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue