diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-02-12 18:19:24 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-02-17 07:26:55 -0800 |
commit | 642d9c80b3597ab512fe937f05e08c10580c06dd (patch) | |
tree | 6e961b97cfb300f61b098b3a63d1df05f0cde91b /core/plannernotes.c | |
parent | 03a7e65cf02602e95ac58b217cc9364546361d2f (diff) | |
download | subsurface-642d9c80b3597ab512fe937f05e08c10580c06dd.tar.gz |
planner: pass in_planner argument to decoMode()
To remove reliance on global state, pass an "in_planner" argument
to decoMode(). Thus, calls to in_planner() can be removed.
This is a more-or-less automated change. Ultimately it would
probably be better to pass the current deco-mode to the affected
functions instead of calling decoMode() with an in_planner
parameter.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/plannernotes.c')
-rw-r--r-- | core/plannernotes.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/plannernotes.c b/core/plannernotes.c index 6b3095082..56e0c40cb 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -86,8 +86,8 @@ const char *get_planner_disclaimer() char *get_planner_disclaimer_formatted() { struct membuffer buf = { 0 }; - const char *deco = decoMode() == VPMB ? translate("gettextFromC", "VPM-B") - : translate("gettextFromC", "BUHLMANN"); + const char *deco = decoMode(true) == VPMB ? translate("gettextFromC", "VPM-B") + : translate("gettextFromC", "BUHLMANN"); put_format(&buf, get_planner_disclaimer(), deco); return detach_cstring(&buf); } @@ -162,7 +162,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d } put_string(&buf, "<br/>\n"); - if (prefs.display_variations && decoMode() != RECREATIONAL) + if (prefs.display_variations && decoMode(true) != RECREATIONAL) put_format_loc(&buf, translate("gettextFromC", "Runtime: %dmin%s"), diveplan_duration(diveplan), "VARIATIONS"); else @@ -420,16 +420,16 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d /* Print the settings for the diveplan next. */ put_string(&buf, "<div>\n"); - if (decoMode() == BUEHLMANN) { + if (decoMode(true) == BUEHLMANN) { put_format_loc(&buf, translate("gettextFromC", "Deco model: Bühlmann ZHL-16C with GFLow = %d%% and GFHigh = %d%%"), diveplan->gflow, diveplan->gfhigh); - } else if (decoMode() == VPMB){ + } else if (decoMode(true) == VPMB) { if (diveplan->vpmb_conservatism == 0) put_string(&buf, translate("gettextFromC", "Deco model: VPM-B at nominal conservatism")); else put_format_loc(&buf, translate("gettextFromC", "Deco model: VPM-B at +%d conservatism"), diveplan->vpmb_conservatism); if (diveplan->eff_gflow) put_format_loc(&buf, translate("gettextFromC", ", effective GF=%d/%d"), diveplan->eff_gflow, diveplan->eff_gfhigh); - } else if (decoMode() == RECREATIONAL){ + } else if (decoMode(true) == RECREATIONAL) { put_format_loc(&buf, translate("gettextFromC", "Deco model: Recreational mode based on Bühlmann ZHL-16B with GFLow = %d%% and GFHigh = %d%%"), diveplan->gflow, diveplan->gfhigh); } @@ -496,7 +496,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d /* not for recreational mode and if no other warning was set before. */ else if (lastbottomdp && gasidx == lastbottomdp->cylinderid - && dive->dc.divemode == OC && decoMode() != RECREATIONAL) { + && dive->dc.divemode == OC && decoMode(true) != RECREATIONAL) { /* Calculate minimum gas volume. */ volume_t mingasv; mingasv.mliter = lrint(prefs.sacfactor / 100.0 * prefs.problemsolvingtime * prefs.bottomsac |