summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Joakim Bygdell <j.bygdell@gmail.com>2015-03-07 16:37:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-03-09 10:39:50 -0700
commit20a82e2b21ecfa6f00b624ebee2cf9958f3190cf (patch)
tree6a1f083067144cdaa210cb6efd2d397a2b4d1fc5 /planner.c
parent237043d6bacd904c58e466116d2cda683dfa63e7 (diff)
downloadsubsurface-20a82e2b21ecfa6f00b624ebee2cf9958f3190cf.tar.gz
Improve gas accounting in the panner
When using gasmixes where the difference is less than 2% the planner can't caclulate casconsumptions correctly. This sets the minimum gasdifference to 1%. Fixes #795 Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index b6f0c4c5e..d5852dc7b 100644
--- a/planner.c
+++ b/planner.c
@@ -115,7 +115,7 @@ int get_gasidx(struct dive *dive, struct gasmix *mix)
int gasidx = -1;
while (++gasidx < MAX_CYLINDERS)
- if (gasmix_distance(&dive->cylinder[gasidx].gasmix, mix) < 200)
+ if (gasmix_distance(&dive->cylinder[gasidx].gasmix, mix) < 100)
return gasidx;
return -1;
}
@@ -210,7 +210,7 @@ static int verify_gas_exists(struct gasmix mix_in)
cyl = displayed_dive.cylinder + i;
if (cylinder_nodata(cyl))
continue;
- if (gasmix_distance(&cyl->gasmix, &mix_in) < 200)
+ if (gasmix_distance(&cyl->gasmix, &mix_in) < 100)
return i;
}
fprintf(stderr, "this gas %s should have been on the cylinder list\nThings will fail now\n", gasname(&mix_in));