mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <dirk@hohndel.org>
This commit is contained in:
parent
d1cd1eb933
commit
7bed6e9873
3 changed files with 15 additions and 8 deletions
|
@ -59,14 +59,21 @@ void DivePlannerPointsModel::removeSelectedPoints(const QVector<int> &rows)
|
||||||
endRemoveRows();
|
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(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), 1 * 60, o2, he, 0, true);
|
||||||
plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, O2_IN_AIR, 0, 0, true);
|
plannerModel->addStop(M_OR_FT(15, 45), 40 * 60, o2, he, 0, true);
|
||||||
if (!planner) {
|
if (!isPlanner()) {
|
||||||
plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, O2_IN_AIR, 0, 0, true);
|
plannerModel->addStop(M_OR_FT(5, 15), 42 * 60, o2, he, 0, true);
|
||||||
plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, O2_IN_AIR, 0, 0, true);
|
plannerModel->addStop(M_OR_FT(5, 15), 45 * 60, o2, he, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
void removeSelectedPoints(const QVector<int> &rows);
|
void removeSelectedPoints(const QVector<int> &rows);
|
||||||
void setPlanMode(Mode mode);
|
void setPlanMode(Mode mode);
|
||||||
bool isPlanner();
|
bool isPlanner();
|
||||||
void createSimpleDive(bool planner = false);
|
void createSimpleDive();
|
||||||
void clear();
|
void clear();
|
||||||
Mode currentMode() const;
|
Mode currentMode() const;
|
||||||
bool setRecalc(bool recalc);
|
bool setRecalc(bool recalc);
|
||||||
|
|
|
@ -419,7 +419,7 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
|
|
||||||
// create a simple starting dive, using the first gas from the just copied cylidners
|
// create a simple starting dive, using the first gas from the just copied cylidners
|
||||||
createFakeDiveForAddAndPlan();
|
createFakeDiveForAddAndPlan();
|
||||||
DivePlannerPointsModel::instance()->createSimpleDive(true);
|
DivePlannerPointsModel::instance()->createSimpleDive();
|
||||||
|
|
||||||
// reload and then disable the dive list
|
// reload and then disable the dive list
|
||||||
ui.ListWidget->reload(DiveTripModel::CURRENT);
|
ui.ListWidget->reload(DiveTripModel::CURRENT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue