diff options
Diffstat (limited to 'qt-ui/diveplanner.cpp')
-rw-r--r-- | qt-ui/diveplanner.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index a80ae68ae..5efb7aaed 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -438,7 +438,7 @@ void DivePlannerPointsModel::loadFromDive(dive* d) // we start with the first gas and see if it was changed int o2 = backupDive.cylinder[0].gasmix.o2.permille; int he = backupDive.cylinder[0].gasmix.he.permille; - for (int i = 0; i < backupDive.dc.samples; i++) { + for (int i = 0; i < backupDive.dc.samples - 1; i++) { const sample &s = backupDive.dc.sample[i]; if (s.time.seconds == 0) continue; @@ -1176,17 +1176,17 @@ bool DivePlannerPointsModel::addGas(int o2, int he) return false; } -int DivePlannerPointsModel::addStop(int milimeters, int minutes, int o2, int he, int ccpoint) +int DivePlannerPointsModel::addStop(int milimeters, int seconds, int o2, int he, int ccpoint) { int row = divepoints.count(); - if (minutes == 0 && milimeters == 0 && row != 0){ + if (seconds == 0 && milimeters == 0 && row != 0){ /* this is only possible if the user clicked on the 'plus' sign on the DivePoints Table */ struct divedatapoint& t = divepoints.last(); milimeters = t.depth; - minutes = t.time + 600; // 10 minutes. - } else if (minutes == 0 && milimeters == 0 && row == 0) { + seconds = t.time + 600; // 10 minutes. + } else if (seconds == 0 && milimeters == 0 && row == 0) { milimeters = M_OR_FT(5, 15); // 5m / 15ft - minutes = 600; // 10 min + seconds = 600; // 10 min } if (o2 != -1) if (!addGas(o2, he)) @@ -1195,14 +1195,14 @@ int DivePlannerPointsModel::addStop(int milimeters, int minutes, int o2, int he, // check if there's already a new stop before this one: for (int i = 0; i < row; i++) { const divedatapoint& dp = divepoints.at(i); - if (dp.time == minutes) { + if (dp.time == seconds) { row = i; beginRemoveRows(QModelIndex(), row, row); divepoints.remove(row); endRemoveRows(); break; } - if (dp.time > minutes ) { + if (dp.time > seconds ) { row = i; break; } @@ -1230,7 +1230,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int minutes, int o2, int he, beginInsertRows(QModelIndex(), row, row); divedatapoint point; point.depth = milimeters; - point.time = minutes; + point.time = seconds; point.o2 = o2; point.he = he; point.po2 = ccpoint; |