diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-19 08:08:29 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-19 08:08:29 -0700 |
commit | 1298aa87e519addde0f5490b238395fcaf8b4e95 (patch) | |
tree | f8e6478e7091bef9f54005df8d94351528faefbe /statistics.c | |
parent | 0cb9b9ccfba97916077a2251153a2f99a44ba9ca (diff) | |
download | subsurface-1298aa87e519addde0f5490b238395fcaf8b4e95.tar.gz |
Continue populating the DiveInfo tab
Pulled one more helper from statistics-gtk.c (but didn't modify the code
there to use it as that code is no longer being compiled).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r-- | statistics.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/statistics.c b/statistics.c index d7f8371fa..411ba1c1f 100644 --- a/statistics.c +++ b/statistics.c @@ -289,3 +289,24 @@ volume_t get_gas_used(struct dive *dive) } return gas_used; } + +#define MAXBUF 80 +/* for the O2/He readings just create a list of them */ +char *get_gaslist(struct dive *dive) +{ + int idx, offset = 0; + static char buf[MAXBUF]; + + buf[0] = '\0'; + for (idx = 0; idx < MAX_CYLINDERS; idx++) { + cylinder_t *cyl = &dive->cylinder[idx]; + if (!cylinder_none(cyl)) { + int o2 = get_o2(&cyl->gasmix); + int he = get_he(&cyl->gasmix); + snprintf(buf + offset, MAXBUF - offset, (offset > 0) ? ", %d/%d" : "%d/%d", + (o2 + 5) / 10, (he + 5) / 10); + offset = strlen(buf); + } + } + return buf; +} |