Use unused cylinders in planner if they are displayed

This makes prefs.display_unused_tanks also relevant for the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-02-15 12:28:46 +01:00 committed by Dirk Hohndel
parent 55898c07ff
commit b60a3d71d3
2 changed files with 4 additions and 3 deletions

View file

@ -129,9 +129,9 @@ void DivePlannerPointsModel::loadFromDive(dive *d)
void DivePlannerPointsModel::setupCylinders()
{
if (mode == PLAN && current_dive) {
// take the used cylinders from the selected dive as starting point
// take the displayed cylinders from the selected dive as starting point
CylindersModel::instance()->copyFromDive(current_dive);
copy_cylinders(current_dive, &displayed_dive, false);
copy_cylinders(current_dive, &displayed_dive, !prefs.display_unused_tanks);
reset_cylinders(&displayed_dive, true);
return;
}

View file

@ -367,7 +367,8 @@ void CylindersModel::copyFromDive(dive *d)
return;
rows = 0;
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (!cylinder_none(&d->cylinder[i]) && is_cylinder_used(d, i)) {
if (!cylinder_none(&d->cylinder[i]) &&
(is_cylinder_used(d, i) || prefs.display_unused_tanks)) {
rows = i + 1;
}
}