mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Set up gaslist only in the beginning of diveplan
In the beginning of the diveplan, divedatapoints of zero duration indicate available gases with the depth giving the suggested switch depth. Zero-duration datapoints in the middle of the dive do not have this meaning and should thus be ignored when composing the gaslist. The tests should have these gas defining segments in the beginning. This fixes a problem when replanning a dive that would change to random gases during deco. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
057419fa85
commit
e31714d9b2
2 changed files with 15 additions and 12 deletions
|
@ -426,8 +426,9 @@ static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, int *gascha
|
|||
struct gaschanges *gaschanges = NULL;
|
||||
struct divedatapoint *dp = diveplan->dp;
|
||||
int best_depth = displayed_dive.cylinder[*asc_cylinder].depth.mm;
|
||||
bool total_time_zero = true;
|
||||
while (dp) {
|
||||
if (dp->time == 0) {
|
||||
if (dp->time == 0 && total_time_zero) {
|
||||
if (dp->depth <= depth) {
|
||||
int i = 0;
|
||||
nr++;
|
||||
|
@ -449,6 +450,8 @@ static struct gaschanges *analyze_gaslist(struct diveplan *diveplan, int *gascha
|
|||
*asc_cylinder = dp->cylinderid;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
total_time_zero = false;
|
||||
}
|
||||
dp = dp->next;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue