summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-03 07:31:03 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-03 07:31:03 -0800
commit08c42813e5d3af8ca702be4333daf46cc14c1d39 (patch)
treee75edfe480b20bd743887e1d868024624a2d5163 /core
parent414d7f2632273420aea8e6cb5291a40ea2111d13 (diff)
downloadsubsurface-08c42813e5d3af8ca702be4333daf46cc14c1d39.tar.gz
Revert "In statistics, ignore gas use of planned dives"
This reverts commit 1d8662006cbb5edae941315e30ede381c23a817b. Mistakenly pushed to master Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/dive.c6
-rw-r--r--core/dive.h2
-rw-r--r--core/divelist.c2
-rw-r--r--core/statistics.c8
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp2
5 files changed, 9 insertions, 11 deletions
diff --git a/core/dive.c b/core/dive.c
index b305df56d..19a950482 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -582,7 +582,7 @@ void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
memset(&d->cylinder[i], 0, sizeof(cylinder_t));
}
for (i = j = 0; i < MAX_CYLINDERS; i++) {
- if (!used_only || is_cylinder_used(s, i, false)) {
+ if (!used_only || is_cylinder_used(s, i)) {
d->cylinder[j].type = s->cylinder[i].type;
d->cylinder[j].type.description = copy_string(s->cylinder[i].type.description);
d->cylinder[j].gasmix = s->cylinder[i].gasmix;
@@ -2050,10 +2050,10 @@ static void merge_cylinders(struct dive *res, struct dive *a, struct dive *b)
} else {
int j=0;
for (i = 0; i < MAX_CYLINDERS && j < MAX_CYLINDERS; i++) {
- if (is_cylinder_used(res, i, false))
+ if (is_cylinder_used(res, i))
continue;
- while (!is_cylinder_used(b, j, false) && j < MAX_CYLINDERS - 1) {
+ while (!is_cylinder_used(b, j) && j < MAX_CYLINDERS - 1) {
mapping[j] = 0;
++j;
}
diff --git a/core/dive.h b/core/dive.h
index 47f2227e3..c9d176920 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -771,7 +771,7 @@ extern void copy_events(struct divecomputer *s, struct divecomputer *d);
extern void free_events(struct event *ev);
extern void copy_cylinders(struct dive *s, struct dive *d, bool used_only);
extern void copy_samples(struct divecomputer *s, struct divecomputer *d);
-extern bool is_cylinder_used(struct dive *dive, int idx, bool ignore_planned);
+extern bool is_cylinder_used(struct dive *dive, int idx);
extern void fill_default_cylinder(cylinder_t *cyl);
extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx);
extern struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name);
diff --git a/core/divelist.c b/core/divelist.c
index 096fc3359..b28dd5ef3 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -119,7 +119,7 @@ void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2max_p)
int o2 = get_o2(&cyl->gasmix);
int he = get_he(&cyl->gasmix);
- if (!is_cylinder_used(dive, i, false))
+ if (!is_cylinder_used(dive, i))
continue;
if (cylinder_none(cyl))
continue;
diff --git a/core/statistics.c b/core/statistics.c
index 6a0ff9f94..62a4d737f 100644
--- a/core/statistics.c
+++ b/core/statistics.c
@@ -326,18 +326,16 @@ void get_selected_dives_text(char *buffer, size_t size)
#define SOME_GAS 5000 // 5bar drop in cylinder pressure makes cylinder used
-bool is_cylinder_used(struct dive *dive, int idx, bool ignore_plannned)
+bool is_cylinder_used(struct dive *dive, int idx)
{
struct divecomputer *dc;
bool firstGasExplicit = false;
if (cylinder_none(&dive->cylinder[idx]))
return false;
- if ((dive->cylinder[idx].start.mbar - dive->cylinder[idx].end.mbar) > SOME_GAS && !ignore_plannned)
+ if ((dive->cylinder[idx].start.mbar - dive->cylinder[idx].end.mbar) > SOME_GAS)
return true;
for_each_dc(dive, dc) {
- if (ignore_plannned && !strcmp(dc->model, "planned dive"))
- continue;
struct event *event = get_next_event(dc->events, "gaschange");
while (event) {
if (dc->sample && (event->time.seconds == 0 ||
@@ -362,7 +360,7 @@ void get_gas_used(struct dive *dive, volume_t gases[MAX_CYLINDERS])
cylinder_t *cyl = &dive->cylinder[idx];
pressure_t start, end;
- if (!is_cylinder_used(dive, idx, true))
+ if (!is_cylinder_used(dive, idx))
continue;
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index cd7c4abca..9814f9a6a 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -186,7 +186,7 @@ QString DiveObjectHelper::gas() const
*/
QString gas, gases;
for (int i = 0; i < MAX_CYLINDERS; i++) {
- if (!is_cylinder_used(m_dive, i, false))
+ if (!is_cylinder_used(m_dive, i))
continue;
gas = m_dive->cylinder[i].type.description;
if (!gas.isEmpty())