diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-01-03 20:45:20 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-03 20:45:20 -0800 |
commit | 2c336032568cd13bec23fce2500bde551141c3e3 (patch) | |
tree | 4d27fd5b219bacf147098549493fbe87207081d1 /divelist.h | |
parent | 5ba250bd48500c9f7aa206324272d40fd3064069 (diff) | |
download | subsurface-2c336032568cd13bec23fce2500bde551141c3e3.tar.gz |
Consider previous dives when calculating deco
This also initializes the N2 tissue saturations to correct numbers
(setting them to zero was clearly silly).
With this commit we walk back in the dive_table until we find a surface
intervall that's longer than 48h. Or a dive that comes after the last one
we looked at; that would indicate that this is a divelist that contains
dives from multiple divers or dives that for other reasons are not
ordered. In a sane environment one would assume that the dives that need
to be taken into account when doing deco calculations are organized as one
trip in the XML file and so this logic should work.
One major downside of the current implementation is that we recalculate
everything whenever the plot_info is recreated - which happens quite
frequently, for example when resizing the window or even when we go into
loup mode. While this isn't all that compute intensive, this is an utter
waste and we should at least cache the saturation inherited from previous
dives (and clear that number when the selected dive changes). We don't
want to cache all of it as the recreation of the plot_info may be
triggered by the user changing equipment (and most importantly, gasmix)
information. In that case the deco data for this dive does indeed have to
be recreated. But without changing the current dive the saturation after
the last surface intervall should stay the same.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.h')
-rw-r--r-- | divelist.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/divelist.h b/divelist.h index b309e9a54..41a9f38ae 100644 --- a/divelist.h +++ b/divelist.h @@ -15,4 +15,5 @@ extern void remember_tree_state(void); extern void restore_tree_state(void); extern void select_next_dive(void); extern void select_prev_dive(void); +extern void init_decompression(struct dive * dive); #endif |