mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
planner: move decotimestap to diveplannermodel.cpp
The deco timestep is a parameter to the plan() function. There seems no need to define this as a global macro. Probably some code reshuffeling artifact. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
4db19d6284
commit
9a052cd089
3 changed files with 5 additions and 5 deletions
|
@ -799,7 +799,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
|
|||
po2, diveplan->surface_pressure / 1000.0, dive, divemode) &&
|
||||
enough_gas(dive, current_cylinder) && clock < 6 * 3600);
|
||||
|
||||
// We did stay one DECOTIMESTEP too many.
|
||||
// We did stay one timestep too many.
|
||||
// In the best of all worlds, we would roll back also the last add_segment in terms of caching deco state, but
|
||||
// let's ignore that since for the eventual ascent in recreational mode, nobody looks at the ceiling anymore,
|
||||
// so we don't really have to compute the deco state.
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "units.h"
|
||||
#include "divemode.h"
|
||||
|
||||
#define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
|
||||
|
||||
/* this should be converted to use our types */
|
||||
struct divedatapoint {
|
||||
int time;
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#define UNIT_FACTOR ((prefs.units.length == units::METERS) ? 1000.0 / 60.0 : feet_to_mm(1.0) / 60.0)
|
||||
|
||||
static constexpr int decotimestep = 60; // seconds
|
||||
|
||||
CylindersModel *DivePlannerPointsModel::cylindersModel()
|
||||
{
|
||||
return &cylinders;
|
||||
|
@ -1078,7 +1080,7 @@ void DivePlannerPointsModel::updateDiveProfile()
|
|||
struct deco_state plan_deco_state;
|
||||
|
||||
memset(&plan_deco_state, 0, sizeof(struct deco_state));
|
||||
plan(&plan_deco_state, &diveplan, d, DECOTIMESTEP, stoptable, cache, isPlanner(), false);
|
||||
plan(&plan_deco_state, &diveplan, d, decotimestep, stoptable, cache, isPlanner(), false);
|
||||
updateMaxDepth();
|
||||
|
||||
if (isPlanner() && shouldComputeVariations()) {
|
||||
|
@ -1290,7 +1292,7 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
|||
createTemporaryPlan();
|
||||
|
||||
struct decostop stoptable[60];
|
||||
plan(&ds_after_previous_dives, &diveplan, d, DECOTIMESTEP, stoptable, cache, isPlanner(), true);
|
||||
plan(&ds_after_previous_dives, &diveplan, d, decotimestep, stoptable, cache, isPlanner(), true);
|
||||
|
||||
if (shouldComputeVariations()) {
|
||||
struct diveplan *plan_copy;
|
||||
|
|
Loading…
Reference in a new issue