mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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) &&
|
po2, diveplan->surface_pressure / 1000.0, dive, divemode) &&
|
||||||
enough_gas(dive, current_cylinder) && clock < 6 * 3600);
|
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
|
// 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,
|
// 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.
|
// so we don't really have to compute the deco state.
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "divemode.h"
|
#include "divemode.h"
|
||||||
|
|
||||||
#define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
|
|
||||||
|
|
||||||
/* this should be converted to use our types */
|
/* this should be converted to use our types */
|
||||||
struct divedatapoint {
|
struct divedatapoint {
|
||||||
int time;
|
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)
|
#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()
|
CylindersModel *DivePlannerPointsModel::cylindersModel()
|
||||||
{
|
{
|
||||||
return &cylinders;
|
return &cylinders;
|
||||||
|
@ -1078,7 +1080,7 @@ void DivePlannerPointsModel::updateDiveProfile()
|
||||||
struct deco_state plan_deco_state;
|
struct deco_state plan_deco_state;
|
||||||
|
|
||||||
memset(&plan_deco_state, 0, sizeof(struct 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();
|
updateMaxDepth();
|
||||||
|
|
||||||
if (isPlanner() && shouldComputeVariations()) {
|
if (isPlanner() && shouldComputeVariations()) {
|
||||||
|
@ -1290,7 +1292,7 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
||||||
createTemporaryPlan();
|
createTemporaryPlan();
|
||||||
|
|
||||||
struct decostop stoptable[60];
|
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()) {
|
if (shouldComputeVariations()) {
|
||||||
struct diveplan *plan_copy;
|
struct diveplan *plan_copy;
|
||||||
|
|
Loading…
Add table
Reference in a new issue