mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Desktop: Fix bug in diveplan for CCR dives with multiple segments.
Fixes a bug reported in https://groups.google.com/g/subsurface-divelog/c/8N3cTz2Zv5E: When planning a CCR dive with multiple segments, the textual dive plan was showing a non-existent gas change with bogus data. The first part of the fix is uncluttering of the message printed: Since this change is _after_ the current diveplanpoint the data needs to come from `nextdp` and not `dp`. The second part is that the message is not printed any more if the current and the following segments have been manually added: According to comments in the code the change should only be printed on the segment _before_ the change if this segment is an ascent segment that is followed by a manually entered segment. Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
parent
c47e28fa29
commit
b9b47092c1
2 changed files with 7 additions and 6 deletions
|
@ -1,3 +1,4 @@
|
|||
desktop: fix bug when printing a dive plan with multiple segments
|
||||
desktop: fix bug in bailout gas selection for CCR dives
|
||||
desktop: fix crash on cylinder update of multiple dives
|
||||
desktop: use dynamic tank use drop down in equipment tab and planner
|
||||
|
|
|
@ -325,15 +325,15 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
/* Normally a gas change is displayed on the stopping segment, so only display a gas change at the end of
|
||||
* an ascent segment if it is not followed by a stop
|
||||
*/
|
||||
if ((isascent || dp->entered) && gaschange_after && dp->next && nextdp && (dp->depth.mm != nextdp->depth.mm || nextdp->entered)) {
|
||||
if (dp->setpoint) {
|
||||
asprintf_loc(&temp, translate("gettextFromC", "(SP = %.1fbar CCR)"), dp->setpoint / 1000.0);
|
||||
if (isascent && gaschange_after && dp->next && nextdp && nextdp->entered) {
|
||||
if (nextdp->setpoint) {
|
||||
asprintf_loc(&temp, translate("gettextFromC", "(SP = %.1fbar CCR)"), nextdp->setpoint / 1000.0);
|
||||
put_format(&buf, "<td style='padding-left: 10px; color: red; float: left;'><b>%s %s</b></td>",
|
||||
gasname(newgasmix), temp);
|
||||
free(temp);
|
||||
} else {
|
||||
put_format(&buf, "<td style='padding-left: 10px; color: red; float: left;'><b>%s %s</b></td>",
|
||||
gasname(newgasmix), lastdivemode == UNDEF_COMP_TYPE || lastdivemode == dp->divemode ? "" : translate("gettextFromC", divemode_text_ui[dp->divemode]));
|
||||
gasname(newgasmix), dp->divemode == UNDEF_COMP_TYPE || dp->divemode == nextdp->divemode ? "" : translate("gettextFromC", divemode_text_ui[nextdp->divemode]));
|
||||
if (isascent && (get_he(lastprintgasmix) > 0)) { // For a trimix gas change on ascent, save ICD info if previous cylinder had helium
|
||||
if (isobaric_counterdiffusion(lastprintgasmix, newgasmix, &icdvalues)) // Do icd calulations
|
||||
icdwarning = true;
|
||||
|
@ -343,9 +343,9 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
}
|
||||
}
|
||||
}
|
||||
lastprintsetpoint = dp->setpoint;
|
||||
lastprintsetpoint = nextdp->setpoint;
|
||||
lastprintgasmix = newgasmix;
|
||||
lastdivemode = dp->divemode;
|
||||
lastdivemode = nextdp->divemode;
|
||||
gaschange_after = false;
|
||||
} else if (gaschange_before || rebreatherchange_before) {
|
||||
// If a new gas has been used for this segment, now is the time to show it
|
||||
|
|
Loading…
Reference in a new issue