summaryrefslogtreecommitdiffstats
path: root/equipment.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-07-17 17:19:19 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-17 08:28:21 -0700
commit950638ec1c560083cbf7c49fc0a5e6139560cc85 (patch)
treea98979ed5a7b8386db6c939ae8f3d5a75c8432ef /equipment.c
parent810880ea1d435e273d2f9b7c2292f3eb6134b1f1 (diff)
downloadsubsurface-950638ec1c560083cbf7c49fc0a5e6139560cc85.tar.gz
Replace cylinder_is_used with is_cylinder_used
is_cylinder_used uses get_cylinder_index as underlaying function that does the right thing with with respect on how to find the closest matching cylinder, and handles both types of gaschange events correctly. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'equipment.c')
-rw-r--r--equipment.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/equipment.c b/equipment.c
index 14d02df77..8ca9f096e 100644
--- a/equipment.c
+++ b/equipment.c
@@ -73,31 +73,6 @@ bool cylinder_none(void *_data)
return cylinder_nodata(cyl) && cylinder_nosamples(cyl);
}
-/* look at all dive computers and figure out if this cylinder is used anywhere
- * d has to be a valid dive (test before calling)
- * cyl does not have to be a cylinder that is part of this dive structure */
-bool cylinder_is_used(struct dive *d, cylinder_t *cyl)
-{
- struct divecomputer *dc = &d->dc;
- bool same_as_first = gasmix_distance(&cyl->gasmix, &d->cylinder[0].gasmix) < 200;
- while (dc) {
- struct event *ev = get_next_event(dc->events, "gaschange");
- if (same_as_first && (!ev || ev->time.seconds > 30)) {
- // unless there is a gas change in the first 30 seconds we can
- // always mark the first cylinder as used
- return true;
- }
- while (ev) {
- if (gasmix_distance(&cyl->gasmix, get_gasmix_from_event(ev)) < 200)
- return true;
-
- ev = get_next_event(ev->next, "gaschange");
- }
- dc = dc->next;
- }
- return false;
-}
-
void get_gas_string(const struct gasmix *gasmix, char *text, int len)
{
if (gasmix_is_air(gasmix))