Don't change gas used in segments if there is still a cylinder with that gas

Otherwise adding a second cylinder (to the default one cylinder of air)
and subsequently changing the gas of that cylinder will illogically change
the gas used in all the segments.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-11-13 21:56:51 +09:00
parent d7fb6853a3
commit 1a3ea5636a

View file

@ -1303,6 +1303,11 @@ void DivePlannerPointsModel::tanksUpdated()
// either nothing relevant changed, or exactly ONE gasmix changed
for (int i = 0; i < gases.length(); i++) {
if (gases.at(i) != oldGases.at(i)) {
if (oldGases.count(oldGases.at(i)) > 1) {
// we had this gas more than once, so don't
// change segments that used this gas as it still exists
break;
}
for (int j = 0; j < rowCount(); j++) {
divedatapoint& p = divepoints[j];
int o2 = oldGases.at(i).first;