get_gas_at_time is now just a wrapper to return the o2 part of the
active gas at a certain time.

Signed-off-by: Anton Lundin <[email protected]>
---
 divelist.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/divelist.c b/divelist.c
index c9e5aeb..2abeac9 100644
--- a/divelist.c
+++ b/divelist.c
@@ -42,6 +42,7 @@
 #include "dive.h"
 #include "divelist.h"
 #include "display.h"
+#include "planner.h"
 
 static short dive_list_changed = false;
 
@@ -152,17 +153,9 @@ int total_weight(struct dive *dive)
 
 static int active_o2(struct dive *dive, struct divecomputer *dc, duration_t 
time)
 {
-       int o2permille = get_o2(&dive->cylinder[0].gasmix);
-       struct event *event;
-
-       for (event = dc->events; event; event = event->next) {
-               if (event->time.seconds > time.seconds)
-                       break;
-               if (strcmp(event->name, "gaschange"))
-                       continue;
-               o2permille = get_o2(get_gasmix_from_event(event));
-       }
-       return o2permille;
+       struct gasmix gas = dive->cylinder[0].gasmix;
+       get_gas_at_time(dive, dc, time, &gas);
+       return get_o2(&gas);
 }
 
 /* calculate OTU for a dive - this only takes the first divecomputer into 
account */
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to