mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Considering previous dives for tissue loading
This (hopefully) gets the logic to find dives in the previous 48h for tissue pre-loading right. In particular it handles the case of a planned dive which has a number of -1. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c7e8042fbd
commit
954d401483
1 changed files with 8 additions and 2 deletions
10
divelist.c
10
divelist.c
|
@ -365,7 +365,13 @@ double init_decompression(struct dive *dive)
|
|||
divenr = get_divenr(dive);
|
||||
when = dive->when;
|
||||
i = divenr;
|
||||
while (i && --i) {
|
||||
if (i < 0) {
|
||||
i = dive_table.nr - 1;
|
||||
while (i >= 0 && get_dive(i)->when > when)
|
||||
--i;
|
||||
i++;
|
||||
}
|
||||
while (i--) {
|
||||
struct dive *pdive = get_dive(i);
|
||||
/* we don't want to mix dives from different trips as we keep looking
|
||||
* for how far back we need to go */
|
||||
|
@ -376,7 +382,7 @@ double init_decompression(struct dive *dive)
|
|||
when = pdive->when;
|
||||
lasttime = when + pdive->duration.seconds;
|
||||
}
|
||||
while (++i < divenr) {
|
||||
while (++i < (divenr >= 0 ? divenr : dive_table.nr)) {
|
||||
struct dive *pdive = get_dive(i);
|
||||
/* again skip dives from different trips */
|
||||
if (dive->divetrip && dive->divetrip != pdive->divetrip)
|
||||
|
|
Loading…
Reference in a new issue