diff options
Diffstat (limited to 'save-git.c')
-rw-r--r-- | save-git.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/save-git.c b/save-git.c index a1ef022fb..308a02c83 100644 --- a/save-git.c +++ b/save-git.c @@ -119,6 +119,18 @@ static void save_tags(struct membuffer *b, struct tag_entry *tags) put_string(b, "\n"); } +static void put_gasmix(struct membuffer *b, struct gasmix *mix) +{ + int o2 = mix->o2.permille; + int he = mix->he.permille; + + if (o2) { + put_format(b, " o2=%u.%u%%", FRACTION(o2, 10)); + if (he) + put_format(b, " he=%u.%u%%", FRACTION(he, 10)); + } +} + static void save_cylinder_info(struct membuffer *b, struct dive *dive) { int i, nr; @@ -128,8 +140,6 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive) cylinder_t *cylinder = dive->cylinder + i; int volume = cylinder->type.size.mliter; const char *description = cylinder->type.description; - int o2 = cylinder->gasmix.o2.permille; - int he = cylinder->gasmix.he.permille; put_string(b, "cylinder"); if (volume) @@ -137,11 +147,7 @@ static void save_cylinder_info(struct membuffer *b, struct dive *dive) put_pressure(b, cylinder->type.workingpressure, " workpressure=", "bar"); show_utf8(b, " description=", description, ""); strip_mb(b); - if (o2) { - put_format(b, " o2=%u.%u%%", FRACTION(o2, 10)); - if (he) - put_format(b, " he=%u.%u%%", FRACTION(he, 10)); - } + put_gasmix(b, &cylinder->gasmix); put_pressure(b, cylinder->start, " start=", "bar"); put_pressure(b, cylinder->end, " end=", "bar"); put_string(b, "\n"); @@ -292,6 +298,13 @@ static void save_one_event(struct membuffer *b, struct event *ev) show_index(b, ev->flags, "flags=", ""); show_index(b, ev->value, "value=", ""); show_utf8(b, " name=", ev->name, ""); + if (event_is_gaschange(ev)) { + if (ev->gas.index >= 0) { + show_index(b, ev->gas.index, "cylinder=", ""); + put_gasmix(b, &ev->gas.mix); + } else if (!event_gasmix_redundant(ev)) + put_gasmix(b, &ev->gas.mix); + } put_string(b, "\n"); } |