mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't confuse cyl with same gasmix with best_first_ascend_gas
When calculating the dive plan in the planner don't accidently use another gas with same gasmix instead of the gas stored as "best_first_ascend_gas". This is important if you have e.g. a bottom stage and back gas with same gas mix because then you always want to start your ascent with the gas you used in last entered dive planner point. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
24bd5a8dce
commit
80a2cd7b1b
1 changed files with 7 additions and 1 deletions
|
@ -867,7 +867,13 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
|
|||
deco_state->first_ceiling_pressure.mbar = deco_state->max_bottom_ceiling_pressure.mbar;
|
||||
|
||||
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
|
||||
if ((current_cylinder = get_gasidx(dive, &gas)) == -1) {
|
||||
/* Always prefer the best_first_ascend_cylinder if it has the right gasmix.
|
||||
* Otherwise take first cylinder from list with rightgasmix */
|
||||
if (same_gasmix(&gas, &dive->cylinder[best_first_ascend_cylinder].gasmix))
|
||||
current_cylinder = best_first_ascend_cylinder;
|
||||
else
|
||||
current_cylinder = get_gasidx(dive, &gas);
|
||||
if (current_cylinder == -1) {
|
||||
report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas));
|
||||
current_cylinder = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue