mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: pass in_planner argument to clear_deco()
To remove reliance on global state, pass an "in_planner" argument to clear_deco(). Thus, calls to in_planner() can be removed. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8103e947aa
commit
03a7e65cf0
4 changed files with 6 additions and 6 deletions
|
@ -503,14 +503,14 @@ void clear_vpmb_state(struct deco_state *ds)
|
|||
ds->max_bottom_ceiling_pressure.mbar = 0;
|
||||
}
|
||||
|
||||
void clear_deco(struct deco_state *ds, double surface_pressure)
|
||||
void clear_deco(struct deco_state *ds, double surface_pressure, bool in_planner)
|
||||
{
|
||||
int ci;
|
||||
|
||||
memset(ds, 0, sizeof(*ds));
|
||||
clear_vpmb_state(ds);
|
||||
for (ci = 0; ci < 16; ci++) {
|
||||
ds->tissue_n2_sat[ci] = (surface_pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 1000;
|
||||
ds->tissue_n2_sat[ci] = (surface_pressure - ((in_planner && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 1000;
|
||||
ds->tissue_he_sat[ci] = 0.0;
|
||||
ds->max_n2_crushing_pressure[ci] = 0.0;
|
||||
ds->max_he_crushing_pressure[ci] = 0.0;
|
||||
|
|
|
@ -52,7 +52,7 @@ extern const double buehlmann_N2_t_halflife[];
|
|||
extern int deco_allowed_depth(double tissues_tolerance, double surface_pressure, const struct dive *dive, bool smooth);
|
||||
|
||||
double get_gf(struct deco_state *ds, double ambpressure_bar, const struct dive *dive);
|
||||
extern void clear_deco(struct deco_state *ds, double surface_pressure);
|
||||
extern void clear_deco(struct deco_state *ds, double surface_pressure, bool in_planner);
|
||||
extern void dump_tissues(struct deco_state *ds);
|
||||
extern void set_gf(short gflow, short gfhigh);
|
||||
extern void set_vpmb_conservatism(short conservatism);
|
||||
|
|
|
@ -521,7 +521,7 @@ int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_p
|
|||
#if DECO_CALC_DEBUG & 2
|
||||
printf("Init deco\n");
|
||||
#endif
|
||||
clear_deco(ds, surface_pressure);
|
||||
clear_deco(ds, surface_pressure, in_planner);
|
||||
deco_init = true;
|
||||
#if DECO_CALC_DEBUG & 2
|
||||
printf("Tissues after init:\n");
|
||||
|
@ -559,7 +559,7 @@ int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_p
|
|||
#if DECO_CALC_DEBUG & 2
|
||||
printf("Init deco\n");
|
||||
#endif
|
||||
clear_deco(ds, surface_pressure);
|
||||
clear_deco(ds, surface_pressure, in_planner);
|
||||
#if DECO_CALC_DEBUG & 2
|
||||
printf("Tissues after no previous dive, surface time set to 48h:\n");
|
||||
dump_tissues(ds);
|
||||
|
|
|
@ -678,7 +678,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
|
|||
if (!diveplan->surface_pressure)
|
||||
diveplan->surface_pressure = SURFACE_PRESSURE;
|
||||
dive->surface_pressure.mbar = diveplan->surface_pressure;
|
||||
clear_deco(ds, dive->surface_pressure.mbar / 1000.0);
|
||||
clear_deco(ds, dive->surface_pressure.mbar / 1000.0, true);
|
||||
ds->max_bottom_ceiling_pressure.mbar = ds->first_ceiling_pressure.mbar = 0;
|
||||
create_dive_from_plan(diveplan, dive, is_planner);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue