diff options
author | Robert C. Helling <helling@atdotde.de> | 2015-08-03 17:29:05 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-03 22:23:17 -0700 |
commit | e79cae577db6d4508dc76dbac09898bae3077d84 (patch) | |
tree | 3069a89df8a7df7025660634c97598d3176d6353 /planner.c | |
parent | abbebef997edde90fe947666084957a206fb6a42 (diff) | |
download | subsurface-e79cae577db6d4508dc76dbac09898bae3077d84.tar.gz |
Decrease gaschange index even if we are already breathing the new mix
This fixes a bug where we would not do any gas changes at all if at the end of
bottom time we were deeper than the MOD of the bottom mix. Instead we would
constantly try to switch to that gas and find we are already breathing it.
A test case would be a dive with air and EAN50 to more than 66m. That would
have never switched to EAN50.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r-- | planner.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1142,6 +1142,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool * We might not if the cylinder was chosen by the user * or user has selected only to switch only at required stops. * If current gas is hypoxic, we want to switch asap */ + if (current_cylinder != gaschanges[gi].gasidx) { if (!prefs.switch_at_req_stop || !trial_ascent(depth, stoplevels[stopidx - 1], avg_depth, bottom_time, tissue_tolerance, @@ -1165,8 +1166,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool */ pendinggaschange = true; } - gi--; } + gi--; } --stopidx; |