mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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:
parent
777e7f32a5
commit
9bb2255ba8
12 changed files with 83 additions and 83 deletions
|
@ -359,6 +359,17 @@ int dive::get_cylinder_index(const struct event &ev) const
|
|||
return best < 0 ? 0 : best;
|
||||
}
|
||||
|
||||
cylinder_t *dive::get_or_create_cylinder(int idx)
|
||||
{
|
||||
if (idx < 0) {
|
||||
report_info("Warning: accessing invalid cylinder %d", idx);
|
||||
return NULL;
|
||||
}
|
||||
while (static_cast<size_t>(idx) >= cylinders.size())
|
||||
add_empty_cylinder(&cylinders);
|
||||
return &cylinders[idx];
|
||||
}
|
||||
|
||||
/* Are there any used cylinders which we do not know usage about? */
|
||||
static bool has_unknown_used_cylinders(const struct dive &dive, const struct divecomputer *dc,
|
||||
const bool used_cylinders[], int num)
|
||||
|
|
|
@ -108,6 +108,7 @@ struct dive {
|
|||
struct gasmix get_gasmix_from_event(const struct event &ev) const;
|
||||
struct gasmix get_gasmix_at_time(const struct divecomputer &dc, duration_t time) const;
|
||||
cylinder_t *get_cylinder(int idx);
|
||||
cylinder_t *get_or_create_cylinder(int idx);
|
||||
const cylinder_t *get_cylinder(int idx) const;
|
||||
weight_t total_weight() const;
|
||||
int get_salinity() const;
|
||||
|
|
|
@ -369,17 +369,6 @@ cylinder_t *add_empty_cylinder(struct cylinder_table *t)
|
|||
return &t->back();
|
||||
}
|
||||
|
||||
cylinder_t *get_or_create_cylinder(struct dive *d, int idx)
|
||||
{
|
||||
if (idx < 0) {
|
||||
report_info("Warning: accessing invalid cylinder %d", idx);
|
||||
return NULL;
|
||||
}
|
||||
while (static_cast<size_t>(idx) >= d->cylinders.size())
|
||||
add_empty_cylinder(&d->cylinders);
|
||||
return &d->cylinders[idx];
|
||||
}
|
||||
|
||||
/* if a default cylinder is set, use that */
|
||||
void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl)
|
||||
{
|
||||
|
|
|
@ -73,7 +73,6 @@ using weightsystem_table = std::vector<weightsystem_t>;
|
|||
extern enum cylinderuse cylinderuse_from_text(const char *text);
|
||||
extern void copy_cylinder_types(const struct dive *s, struct dive *d);
|
||||
extern cylinder_t *add_empty_cylinder(struct cylinder_table *t);
|
||||
extern cylinder_t *get_or_create_cylinder(struct dive *d, int idx);
|
||||
extern void remove_cylinder(struct dive *dive, int idx);
|
||||
extern void remove_weightsystem(struct dive *dive, int idx);
|
||||
extern void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws);
|
||||
|
|
|
@ -70,7 +70,7 @@ static int seac_dive(void *param, int, char **data, char **)
|
|||
state->cur_dive->number = atoi(data[0]);
|
||||
|
||||
// Create first cylinder
|
||||
cylinder_t *curcyl = get_or_create_cylinder(state->cur_dive.get(), 0);
|
||||
cylinder_t *curcyl = state->cur_dive->get_or_create_cylinder(0);
|
||||
|
||||
// Get time and date
|
||||
sscanf(data[2], "%d/%d/%2d", &day, &month, &year);
|
||||
|
@ -238,7 +238,7 @@ static int seac_dive(void *param, int, char **data, char **)
|
|||
seac_gaschange(state, sqlstmt);
|
||||
lastgas = curgas;
|
||||
cylnum ^= 1; // Only need to toggle between two cylinders
|
||||
curcyl = get_or_create_cylinder(state->cur_dive.get(), cylnum);
|
||||
curcyl = state->cur_dive->get_or_create_cylinder(cylnum);
|
||||
curcyl->gasmix.o2.permille = 10 * sqlite3_column_int(sqlstmt, 4);
|
||||
}
|
||||
state->cur_sample->stopdepth.mm = 10 * sqlite3_column_int(sqlstmt, 5);
|
||||
|
|
|
@ -993,23 +993,23 @@ static int divinglog_dive_match(struct dive *dive, const char *name, char *buf,
|
|||
/* For cylinder related fields, we might have to create a cylinder first. */
|
||||
cylinder_t cyl;
|
||||
if (MATCH("tanktype", utf8_string_std, &cyl.type.description)) {
|
||||
get_or_create_cylinder(dive, 0)->type.description = std::move(cyl.type.description);
|
||||
dive->get_or_create_cylinder(0)->type.description = std::move(cyl.type.description);
|
||||
return 1;
|
||||
}
|
||||
if (MATCH("tanksize", cylindersize, &cyl.type.size)) {
|
||||
get_or_create_cylinder(dive, 0)->type.size = cyl.type.size;
|
||||
dive->get_or_create_cylinder(0)->type.size = cyl.type.size;
|
||||
return 1;
|
||||
}
|
||||
if (MATCH_STATE("presw", pressure, &cyl.type.workingpressure)) {
|
||||
get_or_create_cylinder(dive, 0)->type.workingpressure = cyl.type.workingpressure;
|
||||
dive->get_or_create_cylinder(0)->type.workingpressure = cyl.type.workingpressure;
|
||||
return 1;
|
||||
}
|
||||
if (MATCH_STATE("press", pressure, &cyl.start)) {
|
||||
get_or_create_cylinder(dive, 0)->start = cyl.start;
|
||||
dive->get_or_create_cylinder(0)->start = cyl.start;
|
||||
return 1;
|
||||
}
|
||||
if (MATCH_STATE("prese", pressure, &cyl.end)) {
|
||||
get_or_create_cylinder(dive, 0)->end = cyl.end;
|
||||
dive->get_or_create_cylinder(0)->end = cyl.end;
|
||||
return 1;
|
||||
}
|
||||
return MATCH_STATE("divedate", divedate, &dive->when) ||
|
||||
|
@ -1283,11 +1283,11 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str
|
|||
return;
|
||||
}
|
||||
if (MATCH_STATE("cylinderstartpressure", pressure, &p)) {
|
||||
get_or_create_cylinder(dive, 0)->start = p;
|
||||
dive->get_or_create_cylinder(0)->start = p;
|
||||
return;
|
||||
}
|
||||
if (MATCH_STATE("cylinderendpressure", pressure, &p)) {
|
||||
get_or_create_cylinder(dive, 0)->end = p;
|
||||
dive->get_or_create_cylinder(0)->end = p;
|
||||
return;
|
||||
}
|
||||
if (MATCH_STATE("gps", gps_in_dive, dive))
|
||||
|
@ -1858,7 +1858,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size, struct divelog *log)
|
|||
state.cur_dc->surface_pressure.mbar = ((ptr[25] << 8) + ptr[24]) / 10;
|
||||
|
||||
// Declare initial mix as first cylinder
|
||||
cyl = get_or_create_cylinder(state.cur_dive.get(), 0);
|
||||
cyl = state.cur_dive->get_or_create_cylinder(0);
|
||||
cyl->gasmix.o2.permille = ptr[26] * 10;
|
||||
cyl->gasmix.he.permille = ptr[27] * 10;
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
|
|||
/* Create first sample at time = 0, not based on dp because
|
||||
* there is no real dp for time = 0, set first cylinder to 0
|
||||
* O2 setpoint for this sample will be filled later from next dp */
|
||||
cyl = get_or_create_cylinder(dive, 0);
|
||||
cyl = dive->get_or_create_cylinder(0);
|
||||
struct sample *sample = prepare_sample(dc);
|
||||
sample->sac.mliter = prefs.bottomsac;
|
||||
if (track_gas && cyl->type.workingpressure.mbar)
|
||||
|
|
|
@ -324,7 +324,7 @@ void uemis::parse_divelog_binary(std::string_view base64, struct dive *dive)
|
|||
* we store the incorrect working pressure to get the SAC calculations "close"
|
||||
* but the user will have to correct this manually
|
||||
*/
|
||||
cylinder_t *cyl = get_or_create_cylinder(dive, i);
|
||||
cylinder_t *cyl = dive->get_or_create_cylinder(i);
|
||||
cyl->type.size.mliter = lrintf(volume);
|
||||
cyl->type.workingpressure.mbar = 202600;
|
||||
cyl->gasmix.o2.permille = *(uint8_t *)(data.data() + 120 + 25 * (gasoffset + i)) * 10;
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -960,7 +960,7 @@ void smartrak_import(const char *file, struct divelog *log)
|
|||
int tankidxcol = coln(TANKIDX);
|
||||
|
||||
for (i = 0; i < tanks; i++) {
|
||||
cylinder_t *tmptank = get_or_create_cylinder(smtkdive.get(), i);
|
||||
cylinder_t *tmptank = smtkdive->get_or_create_cylinder(i);
|
||||
if (!tmptank)
|
||||
break;
|
||||
if (tmptank->start.mbar == 0)
|
||||
|
|
|
@ -17,7 +17,7 @@ void TestformatDiveGasString::test_empty()
|
|||
void TestformatDiveGasString::test_air()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
@ -28,7 +28,7 @@ void TestformatDiveGasString::test_air()
|
|||
void TestformatDiveGasString::test_nitrox()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 320;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
@ -40,13 +40,13 @@ void TestformatDiveGasString::test_nitrox()
|
|||
void TestformatDiveGasString::test_nitrox_not_use()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 320;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->cylinder_use = NOT_USED;
|
||||
|
@ -59,13 +59,13 @@ void TestformatDiveGasString::test_nitrox_not_use()
|
|||
void TestformatDiveGasString::test_nitrox_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 320;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
@ -77,13 +77,13 @@ void TestformatDiveGasString::test_nitrox_deco()
|
|||
void TestformatDiveGasString::test_reverse_nitrox_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 270;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
@ -95,7 +95,7 @@ void TestformatDiveGasString::test_reverse_nitrox_deco()
|
|||
void TestformatDiveGasString::test_trimix()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
|
@ -108,21 +108,21 @@ void TestformatDiveGasString::test_trimix()
|
|||
void TestformatDiveGasString::test_trimix_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 500;
|
||||
cylinder->gasmix.he.permille = 200;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 2);
|
||||
cylinder = dive.get_or_create_cylinder(2);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
|
@ -134,20 +134,20 @@ void TestformatDiveGasString::test_trimix_deco()
|
|||
void TestformatDiveGasString::test_reverse_trimix_deco()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 500;
|
||||
cylinder->gasmix.he.permille = 200;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 2);
|
||||
cylinder = dive.get_or_create_cylinder(2);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
|
@ -160,14 +160,14 @@ void TestformatDiveGasString::test_reverse_trimix_deco()
|
|||
void TestformatDiveGasString::test_trimix_and_nitrox_same_o2()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 250;
|
||||
cylinder->gasmix.he.permille = 0;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 250;
|
||||
cylinder->gasmix.he.permille = 250;
|
||||
|
@ -180,14 +180,14 @@ void TestformatDiveGasString::test_trimix_and_nitrox_same_o2()
|
|||
void TestformatDiveGasString::test_trimix_and_nitrox_lower_o2()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 220;
|
||||
cylinder->gasmix.he.permille = 0;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 250;
|
||||
cylinder->gasmix.he.permille = 250;
|
||||
|
@ -200,14 +200,14 @@ void TestformatDiveGasString::test_trimix_and_nitrox_lower_o2()
|
|||
void TestformatDiveGasString::test_ccr()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->cylinder_use = OXYGEN;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 350;
|
||||
|
@ -221,14 +221,14 @@ void TestformatDiveGasString::test_ccr()
|
|||
void TestformatDiveGasString::test_ccr_bailout()
|
||||
{
|
||||
struct dive dive;
|
||||
cylinder_t *cylinder = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cylinder = dive.get_or_create_cylinder(0);
|
||||
|
||||
cylinder->gasmix.o2.permille = 1000;
|
||||
cylinder->cylinder_use = OXYGEN;
|
||||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 1);
|
||||
cylinder = dive.get_or_create_cylinder(1);
|
||||
|
||||
cylinder->gasmix.o2.permille = 220;
|
||||
cylinder->gasmix.he.permille = 200;
|
||||
|
@ -236,7 +236,7 @@ void TestformatDiveGasString::test_ccr_bailout()
|
|||
cylinder->start.mbar = 230000;
|
||||
cylinder->end.mbar = 100000;
|
||||
|
||||
cylinder = get_or_create_cylinder(&dive, 2);
|
||||
cylinder = dive.get_or_create_cylinder(2);
|
||||
|
||||
cylinder->gasmix.o2.permille = 210;
|
||||
cylinder->gasmix.he.permille = 0;
|
||||
|
|
|
@ -55,9 +55,9 @@ void setupPlan(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -89,9 +89,9 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 24000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -123,9 +123,9 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 24000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -149,7 +149,7 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp)
|
|||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 100000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -175,8 +175,8 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -204,8 +204,8 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -228,7 +228,7 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
|
|||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 200000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -257,9 +257,9 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 200000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -290,9 +290,9 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 60000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -317,7 +317,7 @@ void setupPlanVpmb30m20min(struct diveplan *dp)
|
|||
dp->decosac = prefs.decosac;
|
||||
|
||||
struct gasmix bottomgas = {{210}, {0}};
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -345,10 +345,10 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl3 = get_or_create_cylinder(&dive, 3);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl3 = dive.get_or_create_cylinder(3);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cyl0->gasmix = bottomgas;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -384,8 +384,8 @@ void setupPlanSeveralGases(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cyl0->gasmix = ean36;
|
||||
cyl0->type.size.mliter = 36000;
|
||||
cyl0->type.workingpressure.mbar = 232000;
|
||||
|
@ -416,9 +416,9 @@ void setupPlanCcr(struct diveplan *dp)
|
|||
// Note: we add the highest-index cylinder first, because
|
||||
// pointers to cylinders are not stable when reallocating.
|
||||
// For testing OK - don't do this in actual code!
|
||||
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||
cylinder_t *cyl2 = dive.get_or_create_cylinder(2);
|
||||
cylinder_t *cyl0 = dive.get_or_create_cylinder(0);
|
||||
cylinder_t *cyl1 = dive.get_or_create_cylinder(1);
|
||||
cyl0->gasmix = diluent;
|
||||
cyl0->depth = dive.gas_mod(diluent, po2, M_OR_FT(3, 10));
|
||||
cyl0->type.size.mliter = 3000;
|
||||
|
|
Loading…
Reference in a new issue