From aa76d3592361ec7b07a8fc15fd466bcd392629ec Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 13 Nov 2013 21:44:18 +0900 Subject: [PATCH] Instead of a "Cylinder for planning" use a default cylinder Right now hardcoded to AL80. This way in the future we'll have a volume of gas that's available. And this makes much more sense then a random string in the description field. Signed-off-by: Dirk Hohndel --- dive.h | 1 + planner.c | 12 +++++++++--- qt-ui/diveplanner.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dive.h b/dive.h index aef6ba366..580610fcf 100644 --- a/dive.h +++ b/dive.h @@ -658,6 +658,7 @@ extern void copy_events(struct dive *s, struct dive *d); extern void copy_cylinders(struct dive *s, struct dive *d); extern void copy_samples(struct dive *s, struct dive *d); +extern void fill_default_cylinder(cylinder_t *cyl); extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx); extern void add_event(struct divecomputer *dc, int time, int type, int flags, int value, const char *name); diff --git a/planner.c b/planner.c index 03efe7465..4e0e567ca 100644 --- a/planner.c +++ b/planner.c @@ -168,6 +168,13 @@ static int time_at_last_depth(struct dive *dive, int o2, int he, unsigned int ne return wait; } +void fill_default_cylinder(cylinder_t *cyl) +{ + cyl->type.description = strdup("AL80"); + cyl->type.size.mliter = 11097; + cyl->type.workingpressure.mbar = 206843; +} + int add_gas(struct dive *dive, int o2, int he) { int i; @@ -185,11 +192,10 @@ int add_gas(struct dive *dive, int o2, int he) if (i == MAX_CYLINDERS) { return -1; } + /* let's make it our default cylinder (right now hardcoded as AL80) */ + fill_default_cylinder(cyl); mix->o2.permille = o2; mix->he.permille = he; - /* since air is stored as 0/0 we need to set a name or an air cylinder - * would be seen as unset (by cylinder_nodata()) */ - cyl->type.description = strdup(translate("gettextFromC","Cylinder for planning")); return i; } diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index bdecf24ad..45360c85c 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -1138,7 +1138,7 @@ bool DivePlannerPointsModel::addGas(int o2, int he) for (int i = 0; i < MAX_CYLINDERS; i++) { if (cylinder_nodata(cyl)) { - cyl->type.description = strdup("Cylinder for planning"); + fill_default_cylinder(cyl); cyl->gasmix.o2.permille = o2; cyl->gasmix.he.permille = he; CylindersModel::instance()->setDive(stagingDive);