From 33888f7ca69661b44b8799f57a435f8a405c9de7 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" <[email protected]> Date: Fri, 5 Dec 2014 15:13:05 +0100 Subject: [PATCH] In diveplan differentiate between last printed depth and last depth
In the decision if a dive segment should lead to a line in the diveplan, we need to differentiate between the lastdepth (the depth of the last dp to tell if we are currently stopping) and the last depth that we printed a line for (needed for gaschange lines). Without this patch, no stops without gas changes were listed anymore in the diveplan. Like the last patch for the diveplan: I hope this time I got this logic right. Signed-off-by: Robert C. Helling <[email protected]> --- planner.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/planner.c b/planner.c index bad995e..d6f1983 100644 --- a/planner.c +++ b/planner.c @@ -514,7 +514,7 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error) { char buffer[20000], temp[1000]; - int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0; + int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0, lastprintdepth = 0; struct divedatapoint *dp = diveplan->dp; bool gaschange = !plan_verbatim, postponed = plan_verbatim; struct divedatapoint *nextdp = NULL; @@ -587,7 +587,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool if (nextdp && (gasmix_distance(&gasmix, &newgasmix) || dp->setpoint != nextdp->setpoint)) gaschange = true; if (plan_verbatim) { - if (dp->depth != lastdepth) { + if (dp->depth != lastprintdepth) { if (plan_display_transitions || dp->entered || !dp->next || (gaschange && dp->next && dp->depth != nextdp->depth)) { if (dp->setpoint) snprintf(temp, sizeof(temp), translate("gettextFromC", "Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s (SP = %.1fbar)"), @@ -684,7 +684,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool gasmix = newgasmix; } } - lastdepth = newdepth; + lastprintdepth = newdepth; + lastdepth = dp->depth; lastsetpoint = dp->setpoint; } while ((dp = nextdp) != NULL); len += snprintf(buffer + len, sizeof(buffer) - len, "</tbody></table></div>"); -- 1.9.3 (Apple Git-50)
My last patch of fixing the printing of gas changes in the dive plan had the effect that only stops with gas changes were printed. This patch should correct that bug. Best Robert -- .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO Robert C. Helling Elite Master Course Theoretical and Mathematical Physics Scientific Coordinator Ludwig Maximilians Universitaet Muenchen, Dept. Physik Phone: +49 89 2180-4523 Theresienstr. 39, rm. B339 http://www.atdotde.de Enhance your privacy, use cryptography! My PGP keys have fingerprints A9D1 A01D 13A5 31FA 6515 BB44 0820 367C 36BC 0C1D and DCED 37B6 251C 7861 270D 5613 95C7 9D32 9A8D 9B8F |
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
