aboutsummaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2021-10-01 15:50:21 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-10-01 08:50:36 -0700
commit41258647d232a24adca394202b44b204409b4c9f (patch)
treea1c0b94973d5e8795cd3b8dba44542c2efa2bdbb /qt-models
parent5e9ee9febb595ced1699e1f60a659e01266ec7e9 (diff)
downloadsubsurface-41258647d232a24adca394202b44b204409b4c9f.tar.gz
Don't access gasmix.o2.fraction
Air is a special gas that does not contain oxygen according to gasmix.o2.fraction. If you want to use the fo2, you need to use get_o2() to treat this special case correctly. This fixes a bug when setting the MND of a gas containing 21% oxygen when o2 is considered not narcotic. Reported-by: Christoph Gruen <gruen.christoph@gmail.com> Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/cylindermodel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index 129fa865a..0824fe8eb 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -445,11 +445,11 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
if (QString::compare(qPrintable(vString), "*") == 0) {
cyl.bestmix_he = true;
// Calculate fO2 for max. depth
- cyl.gasmix.he = best_he(d->maxdepth, d, prefs.o2narcotic, cyl.gasmix.o2);
+ cyl.gasmix.he = best_he(d->maxdepth, d, prefs.o2narcotic, make_fraction(get_o2(cyl.gasmix)));
} else {
cyl.bestmix_he = false;
// Calculate fHe for input depth
- cyl.gasmix.he = best_he(string_to_depth(qPrintable(vString)), d, prefs.o2narcotic, cyl.gasmix.o2);
+ cyl.gasmix.he = best_he(string_to_depth(qPrintable(vString)), d, prefs.o2narcotic, make_fraction(get_o2(cyl.gasmix)));
}
type = Command::EditCylinderType::GASMIX;
break;