mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
aa0cd792bb
commit
6ba140571e
1 changed files with 6 additions and 5 deletions
11
planner.c
11
planner.c
|
@ -171,21 +171,22 @@ static int time_at_last_depth(struct dive *dive, int o2, int he, unsigned int ne
|
||||||
return wait;
|
return wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if a default cylinder is set, use that */
|
||||||
void fill_default_cylinder(cylinder_t *cyl)
|
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 *ti = tank_info;
|
||||||
struct tank_info_t *al80 = NULL;
|
|
||||||
|
|
||||||
|
if (!cyl_name)
|
||||||
|
return;
|
||||||
while (ti->name != NULL) {
|
while (ti->name != NULL) {
|
||||||
if (strcmp(ti->name, cyl_name) == 0)
|
if (strcmp(ti->name, cyl_name) == 0)
|
||||||
break;
|
break;
|
||||||
if (strcmp(ti->name, "AL80") == 0)
|
|
||||||
al80 = ti;
|
|
||||||
ti++;
|
ti++;
|
||||||
}
|
}
|
||||||
if (ti->name == NULL)
|
if (ti->name == NULL)
|
||||||
ti = al80;
|
/* didn't find it */
|
||||||
|
return;
|
||||||
cyl->type.description = strdup(ti->name);
|
cyl->type.description = strdup(ti->name);
|
||||||
if (ti->ml) {
|
if (ti->ml) {
|
||||||
cyl->type.size.mliter = ti->ml;
|
cyl->type.size.mliter = ti->ml;
|
||||||
|
|
Loading…
Add table
Reference in a new issue