summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-08-12 12:06:52 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-15 09:10:29 -0700
commita8ce8c3ef1562559508c77c63ca2d101b3bdcce6 (patch)
tree311b7177db81583ca27a4331e3b91c0c80ead79a /planner.c
parent2455a5dec70d1baa2d0009e602db6b4f19941b56 (diff)
downloadsubsurface-a8ce8c3ef1562559508c77c63ca2d101b3bdcce6.tar.gz
Some unification between Buehlmann and VPM-B
This patch makes deco_allowed_depth() work both for Buehlmann as well as VPM-B (as long as the VPM-B internal variable total_gradient[] is valid). As a bonus, in VPM-B mode, in the planner, the ceilings are VPM-B ceilings and not Buehlmann GF. 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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/planner.c b/planner.c
index 9c0c95f45..3c09a610a 100644
--- a/planner.c
+++ b/planner.c
@@ -33,6 +33,14 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133
double plangflow, plangfhigh;
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;
+/* This is a bit round about: Currently, we only support VPM-B in the planner,
+ * so, when we compute ceilings we have to know if we are in planning mode since
+ * the maximally allowed gradient in the tissues is determined by the critical volume algorithm for
+ * which we currently have no version for logged dives. But the information about the application state
+ * is only available in the C++/Qt part. So this global variable is a way to leak this info. */
+
+bool in_planner = false;
+
const char *disclaimer;
#if DEBUG_PLAN
@@ -879,15 +887,11 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time
tissue_tolerance = add_segment(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0,
gasmix,
TIMESTEP, po2, &displayed_dive, prefs.decosac);
- if (prefs.deco_mode != VPMB && deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > trial_depth - deltad) {
+ if (deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > trial_depth - deltad) {
/* We should have stopped */
clear_to_ascend = false;
break;
}
- if (prefs.deco_mode == VPMB && (!is_vpmb_ok(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0))){
- clear_to_ascend = false;
- break;
- }
trial_depth -= deltad;
}
restore_deco_state(trial_cache);