mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 21:46:17 +00:00
Planner: Change 'lasttime' only if we printed something in the plan.
This makes the 'segment' durations equal the runtime differences even when we don't display transitions in deco. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
40dd6f4c39
commit
14eb0e23af
1 changed files with 5 additions and 2 deletions
|
@ -573,18 +573,21 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
|||
gaschange = true;
|
||||
if (plan_verbatim) {
|
||||
if (dp->depth != lastdepth) {
|
||||
if (plan_display_transitions || dp->entered || !dp->next || (gaschange && dp->next && (dp->depth != dp->next->depth || !dp->next->time)))
|
||||
if (plan_display_transitions || dp->entered || !dp->next || (gaschange && dp->next && (dp->depth != dp->next->depth || !dp->next->time))) {
|
||||
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s<br>"),
|
||||
decimals, depthvalue, depth_unit,
|
||||
FRACTION(dp->time - lasttime, 60),
|
||||
FRACTION(dp->time, 60),
|
||||
gasname(&gasmix));
|
||||
lasttime = dp->time;
|
||||
}
|
||||
} else {
|
||||
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s<br>"),
|
||||
decimals, depthvalue, depth_unit,
|
||||
FRACTION(dp->time - lasttime, 60),
|
||||
FRACTION(dp->time, 60),
|
||||
gasname(&gasmix));
|
||||
lasttime = dp->time;
|
||||
}
|
||||
} else {
|
||||
if (dp->depth == lastdepth || plan_display_transitions || dp->entered || !dp->next || (gaschange && dp->next && (dp->depth != dp->next->depth || !dp->next->time))) {
|
||||
|
@ -600,6 +603,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
|||
len += snprintf(buffer + len, sizeof(buffer) - len, " <td><b> </b><td>");
|
||||
}
|
||||
len += snprintf(buffer + len, sizeof(buffer) - len, "</tr>");
|
||||
lasttime = dp->time;
|
||||
}
|
||||
}
|
||||
if (gaschange) {
|
||||
|
@ -610,7 +614,6 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
|||
}
|
||||
gasmix = newgasmix;
|
||||
}
|
||||
lasttime = dp->time;
|
||||
lastdepth = dp->depth;
|
||||
} while ((dp = dp->next) != NULL);
|
||||
len = strlen(buffer);
|
||||
|
|
Loading…
Add table
Reference in a new issue