mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correct "When merging planned dives keep all cylinders"
When merging a real dive with a planned dive (for comparison), we should not try to be clever in merging similar cylinders, rather keep the union of both cylinder sets as the two versions of the dive might differ in exctly which gas and how much of it was used. Increase MAX_CYLINDERS to 20 to make room for this. We warn if we exceed this number. [Dirk Hohndel: I had mistakenly pushed out an earlier version of this commit, so this fixes things up to the final version] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
08c42813e5
commit
8a8315d6fe
1 changed files with 8 additions and 1 deletions
|
@ -2061,8 +2061,15 @@ static void merge_cylinders(struct dive *res, struct dive *a, struct dive *b)
|
|||
mapping[j] = i;
|
||||
++j;
|
||||
}
|
||||
while (j < MAX_CYLINDERS)
|
||||
bool warn = false;
|
||||
while (j < MAX_CYLINDERS) {
|
||||
if (is_cylinder_used(b, j))
|
||||
warn = true;
|
||||
mapping[j++] = 0;
|
||||
}
|
||||
if (warn) {
|
||||
report_error("Could not merge all cylinders as number exceeds %d", MAX_CYLINDERS);
|
||||
}
|
||||
cylinder_renumber(b, mapping);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue