[PATCH] Make is_gas_used work with SAMPLE_EVENT_GASCHANGE

Anton Lundin glance at acc.umu.se
Sun Oct 6 09:39:21 UTC 2013


SAMPLE_EVENT_GASCHANGE only contains o2 part, and not the he part so
when looking at ex the gaslist for dives/test20.xml it got it realy
wrong.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 statistics.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/statistics.c b/statistics.c
index 83675cf..5637aa2 100644
--- a/statistics.c
+++ b/statistics.c
@@ -317,7 +317,11 @@ bool is_gas_used(struct dive *dive, int idx)
 					if (is_air(o2, he)) {
 						if (is_air(event_o2 * 10, event_he * 10))
 							used = TRUE;
-					} else if (he == event_he * 10 && o2 == event_o2 * 10) {
+					} else if (event->type == 25 && he == event_he * 10 && o2 == event_o2 * 10) {
+						/* SAMPLE_EVENT_GASCHANGE2(25) contains both o2 and he */
+						used = TRUE;
+					} else if (o2 == event_o2 * 10) {
+						/* SAMPLE_EVENT_GASCHANGE(11) only contains o2 */
 						used = TRUE;
 					}
 				}
-- 
1.8.1.2



More information about the subsurface mailing list