diff options
-rw-r--r-- | dive.h | 2 | ||||
-rw-r--r-- | equipment.c | 4 | ||||
-rw-r--r-- | statistics.c | 5 |
3 files changed, 5 insertions, 6 deletions
@@ -87,6 +87,8 @@ typedef struct { pressure_t start, end, sample_start, sample_end; } cylinder_t; +extern int cylinder_none(cylinder_t *cyl); + extern int get_pressure_units(unsigned int mb, const char **units); extern double get_depth_units(unsigned int mm, int *frac, const char **units); extern double get_volume_units(unsigned int mm, int *frac, const char **units); diff --git a/equipment.c b/equipment.c index 2b278934d..037e54208 100644 --- a/equipment.c +++ b/equipment.c @@ -286,7 +286,7 @@ static void show_cylinder(cylinder_t *cyl, struct cylinder_widget *cylinder) gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->o2), o2); } -static int cyl_nothing(cylinder_t *cyl) +int cylinder_none(cylinder_t *cyl) { return !cyl->type.size.mliter && !cyl->type.workingpressure.mbar && @@ -328,7 +328,7 @@ void show_dive_equipment(struct dive *dive) do { cylinder_t *cyl = &dive->cylinder[max-1]; - if (!cyl_nothing(cyl)) + if (!cylinder_none(cyl)) break; } while (--max); diff --git a/statistics.c b/statistics.c index 5cb242e90..f8f9d0e24 100644 --- a/statistics.c +++ b/statistics.c @@ -169,10 +169,7 @@ void show_dive_stats(struct dive *dive) start = cyl->start.mbar ? : cyl->sample_start.mbar; end = cyl->end.mbar ? : cyl->sample_end.mbar; - /* we assume that every valid cylinder has either a working pressure - * or a size; but for good measure let's also accept cylinders with - * a starting or ending pressure*/ - if (cyl->type.workingpressure.mbar || cyl->type.size.mliter || cyl->gasmix.o2.permille || start || end) { + if (!cylinder_none(cyl)) { /* 0% O2 strangely means air, so 21% - I don't like that at all */ int o2 = cyl->gasmix.o2.permille ? : 209; if (offset > 0) { |