diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-10-20 15:07:13 +0200 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2017-10-30 21:45:56 +0100 |
commit | 16f330e6c94f112b56264d6705402c89ed6178a4 (patch) | |
tree | 04c558ae0a5cfdae723871b2e79ebebc183c7f0e | |
parent | 2bfcc5554f4ed77e22244f3ea3b2ae960fa81c80 (diff) | |
download | subsurface-16f330e6c94f112b56264d6705402c89ed6178a4.tar.gz |
Planner remove unnecessary gas consumption info from notes
If we consumed 0l/0bar in total from a cylinder there is no need to also
state that we consumed 0l/0bar during ascend.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r-- | core/plannernotes.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/plannernotes.c b/core/plannernotes.c index a08bce88d..9f9a43f92 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -448,11 +448,18 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d } } /* Print the gas consumption for every cylinder here to temp buffer. */ - snprintf(temp, sz_temp, translate("gettextFromC", "%.0f%s/%.0f%s of <span style='color: red;'><b>%s</b></span> (%.0f%s/%.0f%s in planned ascent)"), volume, unit, pressure, pressure_unit, gasname(&cyl->gasmix), deco_volume, unit, deco_pressure, pressure_unit); + if (lrint(volume) > 0) + snprintf(temp, sz_temp, translate("gettextFromC", "%.0f%s/%.0f%s of <span style='color: red;'><b>%s</b></span> (%.0f%s/%.0f%s in planned ascent)"), volume, unit, pressure, pressure_unit, gasname(&cyl->gasmix), deco_volume, unit, deco_pressure, pressure_unit); + else + snprintf(temp, sz_temp, translate("gettextFromC", "%.0f%s/%.0f%s of <span style='color: red;'><b>%s</b></span>"), volume, unit, pressure, pressure_unit, gasname(&cyl->gasmix)); } else { - snprintf(temp, sz_temp, translate("gettextFromC", "%.0f%s (%.0f%s during planned ascent) of <span style='color: red;'><b>%s</b></span>"), - volume, unit, deco_volume, unit, gasname(&cyl->gasmix)); + if (lrint(volume) > 0) + snprintf(temp, sz_temp, translate("gettextFromC", "%.0f%s of <span style='color: red;'><b>%s</b></span> (%.0f%s during planned ascent)"), + volume, unit, gasname(&cyl->gasmix), deco_volume, unit); + else + snprintf(temp, sz_temp, translate("gettextFromC", "%.0f%s of <span style='color: red;'><b>%s</b></span>"), + volume, unit, gasname(&cyl->gasmix)); } /* Gas consumption: Now finally print all strings to output */ len += snprintf(buffer + len, sz_buffer - len, "%s%s%s<br>", temp, warning, mingas); |