summaryrefslogtreecommitdiffstats
path: root/qt-models/diveplannermodel.cpp
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-29 10:16:00 +0100
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2018-02-27 09:17:57 +0100
commit4cbf8b87a3586d15cff9770d1e3fc9f813498037 (patch)
tree1e524f5f07080f4d3d19034218e5c762d0104781 /qt-models/diveplannermodel.cpp
parentcd5e17cf79c2f1eb896efd0436c103221de446ae (diff)
downloadsubsurface-4cbf8b87a3586d15cff9770d1e3fc9f813498037.tar.gz
Updated strategy for removing cylinders
Change the strategy when to allow cylinder removal from a dive: - Not remove when cylinder has gas switch events, in any other cases allow removal - Remove this whole "cylinder with same gas" thing being a criteria for cylinder removal When removing a cylinder which has corresponding pressure info in samples, also remove this pressure info from the samples. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'qt-models/diveplannermodel.cpp')
-rw-r--r--qt-models/diveplannermodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index 614f194aa..9af6833f0 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -346,8 +346,10 @@ void DivePlannerPointsModel::gasChange(const QModelIndex &index, int newcylinder
void DivePlannerPointsModel::cylinderRenumber(int mapping[])
{
- for (int i = 0; i < rowCount(); i++)
- divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
+ for (int i = 0; i < rowCount(); i++) {
+ if (mapping[divepoints[i].cylinderid] >= 0)
+ divepoints[i].cylinderid = mapping[divepoints[i].cylinderid];
+ }
emitDataChanged();
}