mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move get_max_mod() and get_max_mnd() to struct dive
Feels natural in a C++ code base. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d36fd79527
commit
286d8fe21c
6 changed files with 36 additions and 42 deletions
|
@ -226,13 +226,13 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
|
|||
} else {
|
||||
pressure_t modpO2;
|
||||
modpO2.mbar = inPlanner ? prefs.bottompo2 : (int)(prefs.modpO2 * 1000.0);
|
||||
return get_depth_string(gas_mod(cyl->gasmix, modpO2, d, M_OR_FT(1,1)), true);
|
||||
return get_depth_string(d->gas_mod(cyl->gasmix, modpO2, M_OR_FT(1,1)), true);
|
||||
}
|
||||
case MND:
|
||||
if (cyl->bestmix_he)
|
||||
return QStringLiteral("*");
|
||||
else
|
||||
return get_depth_string(gas_mnd(cyl->gasmix, prefs.bestmixend, d, M_OR_FT(1,1)), true);
|
||||
return get_depth_string(d->gas_mnd(cyl->gasmix, prefs.bestmixend, M_OR_FT(1,1)), true);
|
||||
break;
|
||||
case USE:
|
||||
return gettextFromC::tr(cylinderuse_text[cyl->cylinder_use]);
|
||||
|
@ -403,7 +403,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
|
|||
prefs.o2consumption / prefs.decosac / prefs.pscr_ratio;
|
||||
else
|
||||
modpO2.mbar = prefs.decopo2;
|
||||
cyl.depth = gas_mod(cyl.gasmix, modpO2, d, M_OR_FT(3, 10));
|
||||
cyl.depth = d->gas_mod(cyl.gasmix, modpO2, M_OR_FT(3, 10));
|
||||
cyl.bestmix_o2 = false;
|
||||
}
|
||||
type = Command::EditCylinderType::GASMIX;
|
||||
|
@ -432,7 +432,7 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
|
|||
}
|
||||
pressure_t modpO2;
|
||||
modpO2.mbar = prefs.decopo2;
|
||||
cyl.depth = gas_mod(cyl.gasmix, modpO2, d, M_OR_FT(3, 10));
|
||||
cyl.depth = d->gas_mod(cyl.gasmix, modpO2, M_OR_FT(3, 10));
|
||||
}
|
||||
type = Command::EditCylinderType::GASMIX;
|
||||
break;
|
||||
|
@ -638,8 +638,8 @@ void CylindersModel::updateDecoDepths(pressure_t olddecopo2)
|
|||
for (auto &cyl: d->cylinders) {
|
||||
/* If the gas's deco MOD matches the old pO2, it will have been automatically calculated and should be updated.
|
||||
* If they don't match, we should leave the user entered depth as it is */
|
||||
if (cyl.depth.mm == gas_mod(cyl.gasmix, olddecopo2, d, M_OR_FT(3, 10)).mm) {
|
||||
cyl.depth = gas_mod(cyl.gasmix, decopo2, d, M_OR_FT(3, 10));
|
||||
if (cyl.depth.mm == d->gas_mod(cyl.gasmix, olddecopo2, M_OR_FT(3, 10)).mm) {
|
||||
cyl.depth = d->gas_mod(cyl.gasmix, decopo2, M_OR_FT(3, 10));
|
||||
}
|
||||
}
|
||||
emit dataChanged(createIndex(0, 0), createIndex(numRows - 1, COLUMNS - 1));
|
||||
|
@ -669,7 +669,7 @@ bool CylindersModel::updateBestMixes()
|
|||
cyl.gasmix.he.permille = 1000 - get_o2(cyl.gasmix);
|
||||
pressure_t modpO2;
|
||||
modpO2.mbar = prefs.decopo2;
|
||||
cyl.depth = gas_mod(cyl.gasmix, modpO2, d, M_OR_FT(3, 10));
|
||||
cyl.depth = d->gas_mod(cyl.gasmix, modpO2, M_OR_FT(3, 10));
|
||||
gasUpdated = true;
|
||||
}
|
||||
if (cyl.bestmix_he) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue