mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: remove planner disclaimer from old notes
There used to be code to remove the old planner notes when replanning a dive. It used a global variable and seemed rather brittle. Moreover, the place that set the global variable was inadvertently removed. Therefore has been effectively dead code. Reimplement the functionality, but be more robust by considering that the deco-type may have changed: Split the translated disclaimer string in two parts, before and after the "%s" place-holder. Search for these two parts. Remove the disclaimer and everything after the disclaimer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8ac48a96c7
commit
4706b0f11a
3 changed files with 28 additions and 9 deletions
|
@ -74,6 +74,14 @@ static void add_icd_entry(struct membuffer *b, struct icd_data *icdvalues, bool
|
|||
ambientpressure_mbar * -icdvalues->dHe / 5e6f, translate("gettextFromC", "bar"));
|
||||
}
|
||||
|
||||
const char *get_planner_disclaimer()
|
||||
{
|
||||
return translate("gettextFromC", "DISCLAIMER / WARNING: THIS IMPLEMENTATION OF THE %s "
|
||||
"ALGORITHM AND A DIVE PLANNER IMPLEMENTATION BASED ON THAT HAS "
|
||||
"RECEIVED ONLY A LIMITED AMOUNT OF TESTING. WE STRONGLY RECOMMEND NOT TO "
|
||||
"PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE.");
|
||||
}
|
||||
|
||||
void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error)
|
||||
{
|
||||
struct membuffer buf = { 0 };
|
||||
|
@ -116,10 +124,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
|
||||
if (show_disclaimer) {
|
||||
put_string(&buf, "<div><b>");
|
||||
put_format(&buf, translate("gettextFromC", "DISCLAIMER / WARNING: THIS IMPLEMENTATION OF THE %s "
|
||||
"ALGORITHM AND A DIVE PLANNER IMPLEMENTATION BASED ON THAT HAS "
|
||||
"RECEIVED ONLY A LIMITED AMOUNT OF TESTING. WE STRONGLY RECOMMEND NOT TO "
|
||||
"PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE."), deco);
|
||||
put_format(&buf, get_planner_disclaimer(), deco);
|
||||
put_string(&buf, "</b><br></div>");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue