mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:13:24 +00:00
Planner: don't set cylinder start and end pressure when adding dive
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d4e3745370
commit
cc86d68c86
4 changed files with 7 additions and 7 deletions
2
dive.h
2
dive.h
|
@ -741,7 +741,7 @@ extern bool no_weightsystems(weightsystem_t *ws);
|
|||
extern bool weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2);
|
||||
extern void remove_cylinder(struct dive *dive, int idx);
|
||||
extern void remove_weightsystem(struct dive *dive, int idx);
|
||||
extern void reset_cylinders(struct dive *dive);
|
||||
extern void reset_cylinders(struct dive *dive, bool track_gas);
|
||||
|
||||
/*
|
||||
* String handling.
|
||||
|
|
|
@ -231,8 +231,8 @@ void remove_weightsystem(struct dive *dive, int idx)
|
|||
}
|
||||
|
||||
/* when planning a dive we need to make sure that all cylinders have a sane depth assigned
|
||||
* and that the pressures are reset to start = end = workingpressure */
|
||||
void reset_cylinders(struct dive *dive)
|
||||
* and if we are tracking gas consumption the pressures need to be reset to start = end = workingpressure */
|
||||
void reset_cylinders(struct dive *dive, bool track_gas)
|
||||
{
|
||||
int i;
|
||||
pressure_t pO2 = {.mbar = 1400};
|
||||
|
@ -243,7 +243,7 @@ void reset_cylinders(struct dive *dive)
|
|||
continue;
|
||||
if (cyl->depth.mm == 0) /* if the gas doesn't give a mod, assume conservative pO2 */
|
||||
cyl->depth = gas_mod(&cyl->gasmix, pO2, M_OR_FT(3,10));
|
||||
if (cyl->type.workingpressure.mbar)
|
||||
if (track_gas && cyl->type.workingpressure.mbar)
|
||||
cyl->start.mbar = cyl->end.mbar = cyl->type.workingpressure.mbar;
|
||||
cyl->gas_used.mliter = 0;
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
|
|||
#endif
|
||||
// reset the cylinders and clear out the samples and events of the
|
||||
// displayed dive so we can restart
|
||||
reset_cylinders(&displayed_dive);
|
||||
reset_cylinders(&displayed_dive, track_gas);
|
||||
dc = &displayed_dive.dc;
|
||||
free(dc->sample);
|
||||
dc->sample = NULL;
|
||||
|
|
|
@ -143,7 +143,7 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
// take the used cylinders from the selected dive as starting point
|
||||
CylindersModel::instance()->copyFromDive(current_dive);
|
||||
copy_cylinders(current_dive, &displayed_dive, true);
|
||||
reset_cylinders(&displayed_dive);
|
||||
reset_cylinders(&displayed_dive, true);
|
||||
return;
|
||||
}
|
||||
if (!same_string(prefs.default_cylinder, "")) {
|
||||
|
@ -154,7 +154,7 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
displayed_dive.cylinder[0].type.size.mliter = 11100;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 207000;
|
||||
}
|
||||
reset_cylinders(&displayed_dive);
|
||||
reset_cylinders(&displayed_dive, false);
|
||||
CylindersModel::instance()->copyFromDive(&displayed_dive);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue