Fix adding gas change to a dive

Yikes this was stupid. We mixed changing the displayed_dive and the
current_dive. So we'd pass in the displayed_dive and a pointer to the
dive_computer structure of the current dc in the current dive. Oops.

This makes much more sense. And:

Fixes #738

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-10-30 14:08:10 -07:00
parent 4a42fdaa71
commit 4fa3f89378

View file

@ -1243,7 +1243,9 @@ void ProfileWidget2::changeGas()
qDebug() << "failed to parse tank number";
tank = get_gasidx(&displayed_dive, &gasmix);
}
add_gas_switch_event(&displayed_dive, current_dc, seconds, tank);
// add this both to the displayed dive and the current dive
add_gas_switch_event(current_dive, current_dc, seconds, tank);
add_gas_switch_event(&displayed_dive, get_dive_dc(&displayed_dive, dc_number), seconds, tank);
// this means we potentially have a new tank that is being used and needs to be shown
fixup_dive(&displayed_dive);