Limit recreational dives to 6 hours

Otherwise, with large gradient factors, one can have infinite NDL
which result in an infinite loop when no gas is set.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-01-25 11:44:26 +01:00
parent 6d3c2327bd
commit c6d626c618

View file

@ -782,7 +782,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
clock += timestep;
} while (trial_ascent(ds, 0, depth, 0, avg_depth, bottom_time, &dive->cylinder[current_cylinder].gasmix,
po2, diveplan->surface_pressure / 1000.0, dive) &&
enough_gas(current_cylinder));
enough_gas(current_cylinder) && clock < 6 * 3600);
// We did stay one DECOTIMESTEP too many.
// In the best of all worlds, we would roll back also the last add_segment in terms of caching deco state, but