Store and load the planner related depth info of a cylinder in logfile

Store cylinder.depth in XML files and in git storage.
This info is in fact the gas switch depth of a specific gas/cylinder
in the planner.
This change avoids the need of typing in a user specific depth value
again when replanning an existing planned dive.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-11-27 18:20:21 +01:00 committed by Dirk Hohndel
parent 789e86480d
commit 46004c39e2
4 changed files with 10 additions and 1 deletions

View file

@ -390,6 +390,10 @@ static void parse_cylinder_keyvalue(void *_cylinder, const char *key, const char
cylinder->cylinder_use = cylinderuse_from_text(value); cylinder->cylinder_use = cylinderuse_from_text(value);
return; return;
} }
if (!strcmp(key, "depth")) {
cylinder->depth = get_depth(value);
return;
}
report_error("Unknown cylinder key/value pair (%s/%s)", key, value); report_error("Unknown cylinder key/value pair (%s/%s)", key, value);
} }

View file

@ -1467,6 +1467,8 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf)
return; return;
if (MATCH("use.cylinder", cylinder_use, &dive->cylinder[cur_cylinder_index].cylinder_use)) if (MATCH("use.cylinder", cylinder_use, &dive->cylinder[cur_cylinder_index].cylinder_use))
return; return;
if (MATCH("depth.cylinder", depth, &dive->cylinder[cur_cylinder_index].depth))
return;
if (MATCH("o2", gasmix, &dive->cylinder[cur_cylinder_index].gasmix.o2)) if (MATCH("o2", gasmix, &dive->cylinder[cur_cylinder_index].gasmix.o2))
return; return;
if (MATCH("o2percent", gasmix, &dive->cylinder[cur_cylinder_index].gasmix.o2)) if (MATCH("o2percent", gasmix, &dive->cylinder[cur_cylinder_index].gasmix.o2))

View file

@ -157,7 +157,8 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive)
put_pressure(b, cylinder->end, " end=", "bar"); put_pressure(b, cylinder->end, " end=", "bar");
if (cylinder->cylinder_use != OC_GAS) if (cylinder->cylinder_use != OC_GAS)
put_format(b, " use=%s", cylinderuse_text[cylinder->cylinder_use]); put_format(b, " use=%s", cylinderuse_text[cylinder->cylinder_use]);
if (cylinder->depth.mm != 0)
put_milli(b, " depth='", cylinder->depth.mm, " m'");
put_string(b, "\n"); put_string(b, "\n");
} }
} }

View file

@ -159,6 +159,8 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive)
put_pressure(b, cylinder->end, " end='", " bar'"); put_pressure(b, cylinder->end, " end='", " bar'");
if (cylinder->cylinder_use != OC_GAS) if (cylinder->cylinder_use != OC_GAS)
show_utf8(b, cylinderuse_text[cylinder->cylinder_use], " use='", "'", 1); show_utf8(b, cylinderuse_text[cylinder->cylinder_use], " use='", "'", 1);
if (cylinder->depth.mm != 0)
put_milli(b, " depth='", cylinder->depth.mm, " m'");
put_format(b, " />\n"); put_format(b, " />\n");
} }
} }