diff options
author | Willem Ferguson <willemferguson@zoology.up.ac.za> | 2018-04-07 14:56:37 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-05-14 23:47:00 +0300 |
commit | b9174332d562b8b9c436a94880c51acf2c5ab761 (patch) | |
tree | c6c08d8bc89c602e5f7c75be4fcf1b21777187f9 /core/save-git.c | |
parent | 5f95c226ef4d0def6aafc60a9f4880a3a3374167 (diff) | |
download | subsurface-b9174332d562b8b9c436a94880c51acf2c5ab761.tar.gz |
Read and write divemode changes (xml and git)
This provides for reading of divemode change events from dive logs
and for writing them to dive logs. This applies to xml and git
divelogs. Divemode change events have the following structure:
event->name = "modechange"
event->value = integer corresponding to enum dive_comp_type (dive.c),
reflecting the type of divemode change (OC, CCR, PSCR, etc).
In the dive log file, the event value is written as a string that
corresponds to each of the enum values, e.g.
<event name='modechange' divemode='OC' />
This xml is also read from the dive log file and translated to an
appropriate value of event->value.
The file diveeventitem.cpp was udated to reflect this new way of
dealing with divemode change events.
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Diffstat (limited to 'core/save-git.c')
-rw-r--r-- | core/save-git.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/save-git.c b/core/save-git.c index 395490d83..c0f098d44 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -374,7 +374,11 @@ static void save_one_event(struct membuffer *b, struct dive *dive, struct event put_format(b, "event %d:%02d", FRACTION(ev->time.seconds, 60)); show_index(b, ev->type, "type=", ""); show_index(b, ev->flags, "flags=", ""); - show_index(b, ev->value, "value=", ""); + + if (!strcmp(ev->name,"modechange")) + show_utf8(b, "divemode=", divemode_text[ev->value], ""); + else + show_index(b, ev->value, "value=", ""); show_utf8(b, " name=", ev->name, ""); if (event_is_gaschange(ev)) { struct gasmix *mix = get_gasmix_from_event(dive, ev); |