From 7bed6e987319e60795db049fa2b87817e1badbdf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 27 May 2014 11:28:42 -0700 Subject: Planner: use the gas in the first cylinder for initial plan As Tomaz suggested, I don't need to pass the information whether we are on the planner into the function - it's part of the DivePlannerPointsModel and therefore already knows. Also, we want to make sure we actually use the gas that's in the first cylidner of the staging dive. Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'qt-ui/diveplanner.cpp') diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index f6127e5c4..c02a5b34d 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -59,14 +59,21 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector &rows) endRemoveRows(); } -void DivePlannerPointsModel::createSimpleDive(bool planner) +void DivePlannerPointsModel::createSimpleDive() { + int o2 = O2_IN_AIR; + int he = 0; + if (isPlanner()) { + // let's use the gas from the first cylinder + o2 = stagingDive->cylinder[0].gasmix.o2.permille; + he = stagingDive->cylinder[0].gasmix.he.permille; + } // plannerModel->addStop(0, 0, O2_IN_AIR, 0, 0); - plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, O2_IN_AIR, 0, 0, true); - plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, O2_IN_AIR, 0, 0, true); - if (!planner) { - plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, O2_IN_AIR, 0, 0, true); - plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, O2_IN_AIR, 0, 0, true); + plannerModel->addStop(M_OR_FT(15, 45), 1 * 60, o2, he, 0, true); + plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, o2, he, 0, true); + if (!isPlanner()) { + plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, o2, he, 0, true); + plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, o2, he, 0, true); } } -- cgit v1.2.3-70-g09d2