mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'planner-mods'
Nothing exciting here, just a few independent changes close to each other. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
commit
0de21c24fa
6 changed files with 203 additions and 17 deletions
11
planner.c
11
planner.c
|
@ -380,9 +380,10 @@ void add_to_end_of_diveplan(struct diveplan *diveplan, struct divedatapoint *dp)
|
|||
dp->time += lasttime;
|
||||
}
|
||||
|
||||
struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int o2, int he, int po2)
|
||||
struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int o2, int he, int po2, bool entered)
|
||||
{
|
||||
struct divedatapoint *dp = create_dp(duration, depth, o2, he, po2);
|
||||
dp->entered = entered;
|
||||
add_to_end_of_diveplan(diveplan, dp);
|
||||
return (dp);
|
||||
}
|
||||
|
@ -618,7 +619,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
|
|||
/* if all we wanted was the dive just get us back to the surface */
|
||||
if (!add_deco) {
|
||||
transitiontime = depth / 75; /* this still needs to be made configurable */
|
||||
plan_add_segment(diveplan, transitiontime, 0, o2, he, po2);
|
||||
plan_add_segment(diveplan, transitiontime, 0, o2, he, po2, false);
|
||||
/* re-create the dive */
|
||||
delete_single_dive(dive_table.nr - 1);
|
||||
*divep = dive = create_dive_from_plan(diveplan);
|
||||
|
@ -660,7 +661,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
|
|||
#if DEBUG_PLAN & 2
|
||||
printf("transitiontime %d:%02d to depth %5.2lfm\n", FRACTION(transitiontime, 60), stoplevels[stopidx] / 1000.0);
|
||||
#endif
|
||||
plan_add_segment(diveplan, transitiontime, stoplevels[stopidx], o2, he, po2);
|
||||
plan_add_segment(diveplan, transitiontime, stoplevels[stopidx], o2, he, po2, false);
|
||||
/* re-create the dive */
|
||||
delete_single_dive(dive_table.nr - 1);
|
||||
*divep = dive = create_dive_from_plan(diveplan);
|
||||
|
@ -695,13 +696,13 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
|
|||
stoplevels[stopidx] / 1000.0, ceiling / 1000.0);
|
||||
#endif
|
||||
if (wait_time)
|
||||
plan_add_segment(diveplan, wait_time, stoplevels[stopidx], o2, he, po2);
|
||||
plan_add_segment(diveplan, wait_time, stoplevels[stopidx], o2, he, po2, false);
|
||||
/* right now all the transitions are at 30ft/min - this needs to be configurable */
|
||||
transitiontime = (stoplevels[stopidx] - stoplevels[stopidx - 1]) / 150;
|
||||
#if DEBUG_PLAN & 2
|
||||
printf("transitiontime %d:%02d to depth %5.2lfm\n", FRACTION(transitiontime, 60), stoplevels[stopidx - 1] / 1000.0);
|
||||
#endif
|
||||
plan_add_segment(diveplan, transitiontime, stoplevels[stopidx - 1], o2, he, po2);
|
||||
plan_add_segment(diveplan, transitiontime, stoplevels[stopidx - 1], o2, he, po2, false);
|
||||
/* re-create the dive */
|
||||
delete_single_dive(dive_table.nr - 1);
|
||||
*divep = dive = create_dive_from_plan(diveplan);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue