summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 13:51:19 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 13:51:19 +0000
commit74582de06ccdd5bcec1aa7ed9f77854a765da4e0 (patch)
tree981411e15a2a09ff35b8c225da4a187315d56436 /dive.c
parent0d7c192e6edc1fba710632fd0844126e7c488599 (diff)
downloadsubsurface-74582de06ccdd5bcec1aa7ed9f77854a765da4e0.tar.gz
Add helper function to translate cylinder use text to matching idx
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index 384ce3758..e9ecf3a92 100644
--- a/dive.c
+++ b/dive.c
@@ -583,6 +583,15 @@ void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
}
}
+int cylinderuse_from_text(const char *text)
+{
+ for (enum cylinderuse i = 0; i < NUM_GAS_USE; i++) {
+ if (same_string(text, cylinderuse_text[i]))
+ return i;
+ }
+ return -1;
+}
+
void copy_samples(struct divecomputer *s, struct divecomputer *d)
{
/* instead of carefully copying them one by one and calling add_sample