mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: move gaschange_before / gaschange_after into loop
Declaring everything at the begin of the function is a K&R disease, that makes code very hard to follow. Remove the last assignment to gaschange_after since that is a noop (found by Coverity). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6f91a73a05
commit
696ba61eef
1 changed files with 2 additions and 5 deletions
|
@ -105,8 +105,6 @@ void diveplan::add_plan_to_notes(struct dive &dive, bool show_disclaimer, planne
|
||||||
bool plan_display_runtime = prefs.display_runtime;
|
bool plan_display_runtime = prefs.display_runtime;
|
||||||
bool plan_display_duration = prefs.display_duration;
|
bool plan_display_duration = prefs.display_duration;
|
||||||
bool plan_display_transitions = prefs.display_transitions;
|
bool plan_display_transitions = prefs.display_transitions;
|
||||||
bool gaschange_after = !plan_verbatim;
|
|
||||||
bool gaschange_before;
|
|
||||||
bool rebreatherchange_after = !plan_verbatim;
|
bool rebreatherchange_after = !plan_verbatim;
|
||||||
bool rebreatherchange_before;
|
bool rebreatherchange_before;
|
||||||
enum divemode_t lastdivemode = UNDEF_COMP_TYPE;
|
enum divemode_t lastdivemode = UNDEF_COMP_TYPE;
|
||||||
|
@ -211,8 +209,8 @@ void diveplan::add_plan_to_notes(struct dive &dive, bool show_disclaimer, planne
|
||||||
bool atend = nextdp == this->dp.end();
|
bool atend = nextdp == this->dp.end();
|
||||||
if (!atend)
|
if (!atend)
|
||||||
newgasmix = dive.get_cylinder(nextdp->cylinderid)->gasmix;
|
newgasmix = dive.get_cylinder(nextdp->cylinderid)->gasmix;
|
||||||
gaschange_after = (!atend && (gasmix_distance(gasmix, newgasmix)));
|
bool gaschange_after = (!atend && (gasmix_distance(gasmix, newgasmix)));
|
||||||
gaschange_before = (gasmix_distance(lastprintgasmix, gasmix));
|
bool gaschange_before = (gasmix_distance(lastprintgasmix, gasmix));
|
||||||
rebreatherchange_after = (!atend && (dp->setpoint != nextdp->setpoint || dp->divemode != nextdp->divemode));
|
rebreatherchange_after = (!atend && (dp->setpoint != nextdp->setpoint || dp->divemode != nextdp->divemode));
|
||||||
rebreatherchange_before = lastprintsetpoint != dp->setpoint || lastdivemode != dp->divemode;
|
rebreatherchange_before = lastprintsetpoint != dp->setpoint || lastdivemode != dp->divemode;
|
||||||
/* do we want to skip this leg as it is devoid of anything useful? */
|
/* do we want to skip this leg as it is devoid of anything useful? */
|
||||||
|
@ -408,7 +406,6 @@ void diveplan::add_plan_to_notes(struct dive &dive, bool show_disclaimer, planne
|
||||||
buf += "<br/>\n";
|
buf += "<br/>\n";
|
||||||
}
|
}
|
||||||
lastprintgasmix = newgasmix;
|
lastprintgasmix = newgasmix;
|
||||||
gaschange_after = false;
|
|
||||||
gasmix = newgasmix;
|
gasmix = newgasmix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue