diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2019-08-25 20:05:05 +0200 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2019-08-26 13:19:06 +0200 |
commit | 0e55739f03d15b93a678e29bb1af26ff703f0c2f (patch) | |
tree | 1690babe45d280c4d08e1b30d7bfa2a9d4d48e68 | |
parent | 96f71e6cb1bacbc3fcb0fda9a2b6734f857f150c (diff) | |
download | subsurface-0e55739f03d15b93a678e29bb1af26ff703f0c2f.tar.gz |
Show surface degassing in the planner only when configured time != 0
This prevents from useless "Air" tag in profile when this feature is
not used.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r-- | core/planner.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/core/planner.c b/core/planner.c index 2ce001d39..3fef02248 100644 --- a/core/planner.c +++ b/core/planner.c @@ -1099,15 +1099,17 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i diveplan->eff_gflow = lrint(100.0 * (regressiona(ds) * first_stop_depth + regressionb(ds))); } - for (int i = 0; i < MAX_CYLINDERS; i++) - if (cylinder_nodata(&dive->cylinder[i])) { - // Switch to an empty air cylinder for breathing air at the surface - // If no empty cylinder is found, keep using last deco gas - current_cylinder = i; - dive->cylinder[i].cylinder_use = NOT_USED; - break; - } - plan_add_segment(diveplan, prefs.surface_segment, 0, current_cylinder, 0, false, OC); + if (prefs.surface_segment != 0) { + for (int i = 0; i < MAX_CYLINDERS; i++) + if (cylinder_nodata(&dive->cylinder[i])) { + // Switch to an empty air cylinder for breathing air at the surface + // If no empty cylinder is found, keep using last deco gas + current_cylinder = i; + dive->cylinder[i].cylinder_use = NOT_USED; + break; + } + plan_add_segment(diveplan, prefs.surface_segment, 0, current_cylinder, 0, false, OC); + } create_dive_from_plan(diveplan, dive, is_planner); add_plan_to_notes(diveplan, dive, show_disclaimer, error); fixup_dc_duration(&dive->dc); |