Start hooking in the deco calculations

I expanded the DiveHandler to include the actual time / depth of each
node on the graph - this way things will stay consistent if we need to
rescale the graph.

One thing that this makes obvious is that the whole design for the
planner so far assumes metric data. We need to make sure this works well
with feet instead of meters as well (and that it uses the information in
the units settings).

With this change we actually create a dive based on the plan input and
add the deco stops (if needed) to it - but we don't do anything with the
results of those calculations, yet.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-06-23 18:04:35 -07:00
parent 4a184a60fc
commit 596095389b
5 changed files with 40 additions and 9 deletions

View file

@ -495,6 +495,7 @@ static int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, int gnr)
return stoplevels;
}
#if USE_GTK_UI
static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
{
char buffer[20000];
@ -590,6 +591,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
}
dive->notes = strdup(buffer);
}
#endif
void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, char **error_string_p)
{
@ -698,8 +700,8 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, c
record_dive(dive);
stopidx--;
}
add_plan_to_notes(diveplan, dive);
#if USE_GTK_UI
add_plan_to_notes(diveplan, dive);
/* now make the dive visible in the dive list */
report_dives(FALSE, FALSE);
show_and_select_dive(dive);
@ -709,6 +711,7 @@ error_exit:
free(gaschanges);
}
#if USE_GTK_UI
/*
* Get a value in tenths (so "10.2" == 102, "9" = 90)
*
@ -1013,4 +1016,4 @@ timestamp_t current_time_notz(void)
struct tm *local = localtime(&now);
return utc_mktime(local);
}
#endif