summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-13 21:56:51 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-13 21:56:51 +0900
commit1a3ea5636a7671e18c9f220e3ba181ef62740df8 (patch)
tree2fbc0e085228d3f9863efe49d1c785dfacdb7f79 /qt-ui
parentd7fb6853a30d430d73df9d1b076ea194ddeacac2 (diff)
downloadsubsurface-1a3ea5636a7671e18c9f220e3ba181ef62740df8.tar.gz
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>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/diveplanner.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 65a358489..6bc67ada0 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -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;