From ff6bf497c8ae8ee713f9f55da07f7d45bcf9fb20 Mon Sep 17 00:00:00 2001 From: Joakim Bygdell Date: Wed, 8 Jul 2015 06:58:06 +0200 Subject: Planner: update disclamer Update the disclamer text to reflect which algorithm where used. [Dirk Hohndel: cleaned up coding style & replaced snprintf with strncat] Signed-off-by: Joakim Bygdell Signed-off-by: Dirk Hohndel --- planner.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'planner.c') diff --git a/planner.c b/planner.c index 8569fc904..e5685a499 100644 --- a/planner.c +++ b/planner.c @@ -500,7 +500,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[2000000], temp[100000]; + char buffer[2000000], temp[100000], *deco, buf[1000]; int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0, lastprintdepth = 0, lastprintsetpoint = -1; struct gasmix lastprintgasmix = { -1, -1 }; struct divedatapoint *dp = diveplan->dp; @@ -513,10 +513,17 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool plan_display_duration = prefs.display_duration; plan_display_transitions = prefs.display_transitions; - disclaimer = translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE BUHLMANN " + if (prefs.deco_mode == VPMB) { + deco = "VPM-B"; + } else { + deco = "BUHLMANN"; + } + + snprintf(buf, sizeof(buf), translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE %s " "ALGORITHM AND A DIVE PLANNER IMPLEMENTATION BASED ON THAT WHICH HAS " "RECEIVED ONLY A LIMITED AMOUNT OF TESTING. WE STRONGLY RECOMMEND NOT TO " - "PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE."); + "PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE."), deco); + disclaimer = buf; if (!dp) return; @@ -531,8 +538,12 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool } len = show_disclaimer ? snprintf(buffer, sizeof(buffer), "
%s

", disclaimer) : 0; - snprintf(temp, sizeof(temp), translate("gettextFromC", "based on GFlow = %d and GFhigh = %d"), - diveplan->gflow, diveplan->gfhigh); + if (prefs.deco_mode == BUEHLMANN){ + snprintf(temp, sizeof(temp), translate("gettextFromC", "based on Buhlmann ZHL-16B with GFlow = %d and GFhigh = %d"), + diveplan->gflow, diveplan->gfhigh); + } else if (prefs.deco_mode == VPMB){ + strncat(temp, translate("gettextFromC", "based on VPM-B"), sizeof(temp) - 1); + } len += snprintf(buffer + len, sizeof(buffer) - len, "
%s
%s

", translate("gettextFromC", "Subsurface dive plan"), temp); -- cgit v1.2.3-70-g09d2