mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Only calculate with he when he is present in event
Old gasswitch events only contains O2, so don't look at he part when the event doesn't contain a He part. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b75aee33fe
commit
93d6eb1397
1 changed files with 8 additions and 1 deletions
|
@ -646,7 +646,14 @@ static int get_cylinder_index(struct dive *dive, struct event *ev)
|
|||
|
||||
delta_o2 = get_o2(&cyl->gasmix) - target_o2;
|
||||
delta_he = get_he(&cyl->gasmix) - target_he;
|
||||
distance = delta_o2 * delta_o2 + delta_he * delta_he;
|
||||
distance = delta_o2 * delta_o2;
|
||||
|
||||
/* Check the event type to figure out if we should care about the he part.
|
||||
* 11 is SAMPLE_EVENT_GASCHANGE, aka without he
|
||||
* 25 is SAMPLE_EVENT_GASCHANGE2, aka with he
|
||||
*/
|
||||
if (ev->type == 25)
|
||||
distance += delta_he * delta_he;
|
||||
if (distance >= score)
|
||||
continue;
|
||||
score = distance;
|
||||
|
|
Loading…
Add table
Reference in a new issue