diff options
author | Robert C. Helling <helling@atdotde.de> | 2019-01-01 18:49:56 +0100 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2019-01-08 10:39:06 +0100 |
commit | 123f3ef7ec8f977c9949c3ac24008163c722e208 (patch) | |
tree | e71fae75814d32e249cb5e99d8eb231ffc88cb07 /core/dive.c | |
parent | c349692d984f417bf56f5fecb8f733d8fb007518 (diff) | |
download | subsurface-123f3ef7ec8f977c9949c3ac24008163c722e208.tar.gz |
Filter for logged/planned dives
Add filter for dives having a planned dive computer or
a logged dive computer.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/dive.c b/core/dive.c index 0ec9e381c..36d05dad5 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3361,6 +3361,18 @@ bool is_dc_planner(const struct divecomputer *dc) { return same_string(dc->model, "planned dive"); } +// Does this dive have a dive computer for which is_dc_planner has value planned +bool has_planned(const struct dive *dive, bool planned) { + const struct divecomputer *dc = &dive->dc; + + while (dc) { + if (is_dc_planner(&dive->dc) == planned) + return true; + dc = dc->next; + } + return false; +} + /* * Merging two dives can be subtle, because there's two different ways * of merging: |