summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-15 13:09:36 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-15 13:09:36 -0700
commit6ba140571e2fdb1514fff27430a82e6f96ed83b8 (patch)
tree4c83880fbe9a3f6a8aabb8821dc1c42f637feea2 /planner.c
parentaa0cd792bbe3e5c2dbaaaaff77688f4ee96c694c (diff)
downloadsubsurface-6ba140571e2fdb1514fff27430a82e6f96ed83b8.tar.gz
Only use a default cylinder if it is explicitly set
We used to fall back to an AL80 default cylinder, but that meant that a user who doesn't want a default cylinder at all had no way to indicate that. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/planner.c b/planner.c
index 96f3bc7e0..825f39f1a 100644
--- a/planner.c
+++ b/planner.c
@@ -171,21 +171,22 @@ static int time_at_last_depth(struct dive *dive, int o2, int he, unsigned int ne
return wait;
}
+/* if a default cylinder is set, use that */
void fill_default_cylinder(cylinder_t *cyl)
{
- const char *cyl_name = prefs.default_cylinder != NULL ? prefs.default_cylinder : "AL80";
+ const char *cyl_name = prefs.default_cylinder;
struct tank_info_t *ti = tank_info;
- struct tank_info_t *al80 = NULL;
+ if (!cyl_name)
+ return;
while (ti->name != NULL) {
if (strcmp(ti->name, cyl_name) == 0)
break;
- if (strcmp(ti->name, "AL80") == 0)
- al80 = ti;
ti++;
}
if (ti->name == NULL)
- ti = al80;
+ /* didn't find it */
+ return;
cyl->type.description = strdup(ti->name);
if (ti->ml) {
cyl->type.size.mliter = ti->ml;