diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-11-04 12:15:27 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-04 07:21:34 -0800 |
commit | 20a9db779d3a7ba1591e8d336c6b99b80aef71de (patch) | |
tree | 9fa678ed3da32dc3b0e6006c11c78eb4a272adcf /divelist.c | |
parent | 06ddfc01222879ee0463affe796dba05de33b368 (diff) | |
download | subsurface-20a9db779d3a7ba1591e8d336c6b99b80aef71de.tar.gz |
Offer to save to a copy in replan mode
When replannig a dive, offer another button that creates a new
dive rather than overwriting the old. This should help in creating
several versions of a planned dive (longer/shorter, deeper/shallower
etc). Note that this makes dives that start at the same time not
influcence each other's deco.
Also, only the first of a row of simultaneous dives contributes to
the tissue loadings of later dives.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c index 7efafa88c..9034007b7 100644 --- a/divelist.c +++ b/divelist.c @@ -347,7 +347,7 @@ double init_decompression(struct dive *dive) { int i, divenr = -1; unsigned int surface_time; - timestamp_t when, lasttime = 0; + timestamp_t when, lasttime = 0, laststart = 0; bool deco_init = false; double tissue_tolerance, surface_pressure; @@ -370,8 +370,11 @@ double init_decompression(struct dive *dive) * for how far back we need to go */ if (dive->divetrip && pdive->divetrip != dive->divetrip) continue; - if (!pdive || pdive->when > when || pdive->when + pdive->duration.seconds + 48 * 60 * 60 < when) + if (!pdive || pdive->when >= when || pdive->when + pdive->duration.seconds + 48 * 60 * 60 < when) break; + /* For simultaneous dives, only consider the first */ + if (pdive->when == laststart) + continue; when = pdive->when; lasttime = when + pdive->duration.seconds; } @@ -389,6 +392,7 @@ double init_decompression(struct dive *dive) #endif } add_dive_to_deco(pdive); + laststart = pdive->when; #if DECO_CALC_DEBUG & 2 printf("added dive #%d\n", pdive->number); dump_tissues(); |