core: move get_or_create_cylinder() to struct dive

Other cylinder-creation functions were already there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-30 22:39:52 +02:00 committed by bstoeger
parent 777e7f32a5
commit 9bb2255ba8
12 changed files with 83 additions and 83 deletions

View file

@ -1245,7 +1245,7 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
if (state != "add" && !d->is_cylinder_used(i))
continue;
cylinder_t *cyl = get_or_create_cylinder(d, i);
cylinder_t *cyl = d->get_or_create_cylinder(i);
cyl->start.mbar = parsePressureToMbar(startpressure[j]);
cyl->end.mbar = parsePressureToMbar(endpressure[j]);
if (cyl->end.mbar > cyl->start.mbar)
@ -1267,7 +1267,7 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
he >= 0 && he <= 1000 &&
o2 + he <= 1000) {
diveChanged = true;
get_or_create_cylinder(d, i)->gasmix.o2.permille = o2;
d->get_or_create_cylinder(i)->gasmix.o2.permille = o2;
d->get_cylinder(i)->gasmix.he.permille = he;
}
j++;
@ -1293,7 +1293,7 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt
break;
}
}
get_or_create_cylinder(d, j)->type.description = usedCylinder[k].toStdString();
d->get_or_create_cylinder(j)->type.description = usedCylinder[k].toStdString();
d->get_cylinder(j)->type.size.mliter = size;
d->get_cylinder(j)->type.workingpressure.mbar = wp;
k++;