mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Revert "In statistics, ignore gas use of planned dives"
This reverts commit 1d8662006c
.
Mistakenly pushed to master
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
414d7f2632
commit
08c42813e5
8 changed files with 14 additions and 16 deletions
|
@ -582,7 +582,7 @@ void copy_cylinders(struct dive *s, struct dive *d, bool used_only)
|
||||||
memset(&d->cylinder[i], 0, sizeof(cylinder_t));
|
memset(&d->cylinder[i], 0, sizeof(cylinder_t));
|
||||||
}
|
}
|
||||||
for (i = j = 0; i < MAX_CYLINDERS; i++) {
|
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 = s->cylinder[i].type;
|
||||||
d->cylinder[j].type.description = copy_string(s->cylinder[i].type.description);
|
d->cylinder[j].type.description = copy_string(s->cylinder[i].type.description);
|
||||||
d->cylinder[j].gasmix = s->cylinder[i].gasmix;
|
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 {
|
} else {
|
||||||
int j=0;
|
int j=0;
|
||||||
for (i = 0; i < MAX_CYLINDERS && j < MAX_CYLINDERS; i++) {
|
for (i = 0; i < MAX_CYLINDERS && j < MAX_CYLINDERS; i++) {
|
||||||
if (is_cylinder_used(res, i, false))
|
if (is_cylinder_used(res, i))
|
||||||
continue;
|
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;
|
mapping[j] = 0;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,7 +771,7 @@ extern void copy_events(struct divecomputer *s, struct divecomputer *d);
|
||||||
extern void free_events(struct event *ev);
|
extern void free_events(struct event *ev);
|
||||||
extern void copy_cylinders(struct dive *s, struct dive *d, bool used_only);
|
extern void copy_cylinders(struct dive *s, struct dive *d, bool used_only);
|
||||||
extern void copy_samples(struct divecomputer *s, struct divecomputer *d);
|
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 fill_default_cylinder(cylinder_t *cyl);
|
||||||
extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx);
|
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);
|
extern struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name);
|
||||||
|
|
|
@ -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 o2 = get_o2(&cyl->gasmix);
|
||||||
int he = get_he(&cyl->gasmix);
|
int he = get_he(&cyl->gasmix);
|
||||||
|
|
||||||
if (!is_cylinder_used(dive, i, false))
|
if (!is_cylinder_used(dive, i))
|
||||||
continue;
|
continue;
|
||||||
if (cylinder_none(cyl))
|
if (cylinder_none(cyl))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -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
|
#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;
|
struct divecomputer *dc;
|
||||||
bool firstGasExplicit = false;
|
bool firstGasExplicit = false;
|
||||||
if (cylinder_none(&dive->cylinder[idx]))
|
if (cylinder_none(&dive->cylinder[idx]))
|
||||||
return false;
|
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;
|
return true;
|
||||||
for_each_dc(dive, dc) {
|
for_each_dc(dive, dc) {
|
||||||
if (ignore_plannned && !strcmp(dc->model, "planned dive"))
|
|
||||||
continue;
|
|
||||||
struct event *event = get_next_event(dc->events, "gaschange");
|
struct event *event = get_next_event(dc->events, "gaschange");
|
||||||
while (event) {
|
while (event) {
|
||||||
if (dc->sample && (event->time.seconds == 0 ||
|
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];
|
cylinder_t *cyl = &dive->cylinder[idx];
|
||||||
pressure_t start, end;
|
pressure_t start, end;
|
||||||
|
|
||||||
if (!is_cylinder_used(dive, idx, true))
|
if (!is_cylinder_used(dive, idx))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
||||||
|
|
|
@ -186,7 +186,7 @@ QString DiveObjectHelper::gas() const
|
||||||
*/
|
*/
|
||||||
QString gas, gases;
|
QString gas, gases;
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
||||||
if (!is_cylinder_used(m_dive, i, false))
|
if (!is_cylinder_used(m_dive, i))
|
||||||
continue;
|
continue;
|
||||||
gas = m_dive->cylinder[i].type.description;
|
gas = m_dive->cylinder[i].type.description;
|
||||||
if (!gas.isEmpty())
|
if (!gas.isEmpty())
|
||||||
|
|
|
@ -277,7 +277,7 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAX_CYLINDERS; i++)
|
for (i = 0; i < MAX_CYLINDERS; i++)
|
||||||
if (is_cylinder_used(dive, i, false))
|
if (is_cylinder_used(dive, i))
|
||||||
delta_p.mbar += dive->cylinder[i].start.mbar - dive->cylinder[i].end.mbar;
|
delta_p.mbar += dive->cylinder[i].start.mbar - dive->cylinder[i].end.mbar;
|
||||||
|
|
||||||
if (need_pagebreak)
|
if (need_pagebreak)
|
||||||
|
|
|
@ -594,7 +594,7 @@ void MainTab::updateDiveInfo(bool clear)
|
||||||
|
|
||||||
gaslist = ""; SACs = ""; volumes = ""; separator = "";
|
gaslist = ""; SACs = ""; volumes = ""; separator = "";
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
||||||
if (!is_cylinder_used(&displayed_dive, i, false))
|
if (!is_cylinder_used(&displayed_dive, i))
|
||||||
continue;
|
continue;
|
||||||
gaslist.append(separator); volumes.append(separator); SACs.append(separator);
|
gaslist.append(separator); volumes.append(separator); SACs.append(separator);
|
||||||
separator = "\n";
|
separator = "\n";
|
||||||
|
|
|
@ -451,7 +451,7 @@ void CylindersModel::updateDive()
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
||||||
if (!cylinder_none(&displayed_dive.cylinder[i]) &&
|
if (!cylinder_none(&displayed_dive.cylinder[i]) &&
|
||||||
(prefs.display_unused_tanks ||
|
(prefs.display_unused_tanks ||
|
||||||
is_cylinder_used(&displayed_dive, i, false) ||
|
is_cylinder_used(&displayed_dive, i) ||
|
||||||
displayed_dive.cylinder[i].manually_added))
|
displayed_dive.cylinder[i].manually_added))
|
||||||
rows = i + 1;
|
rows = i + 1;
|
||||||
}
|
}
|
||||||
|
@ -468,7 +468,7 @@ void CylindersModel::copyFromDive(dive *d)
|
||||||
rows = 0;
|
rows = 0;
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
||||||
if (!cylinder_none(&d->cylinder[i]) &&
|
if (!cylinder_none(&d->cylinder[i]) &&
|
||||||
(is_cylinder_used(d, i, false) || prefs.display_unused_tanks)) {
|
(is_cylinder_used(d, i) || prefs.display_unused_tanks)) {
|
||||||
rows = i + 1;
|
rows = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ void CylindersModel::remove(const QModelIndex &index)
|
||||||
((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
|
((DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING &&
|
||||||
DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
|
DivePlannerPointsModel::instance()->tankInUse(index.row())) ||
|
||||||
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&
|
(DivePlannerPointsModel::instance()->currentMode() == DivePlannerPointsModel::NOTHING &&
|
||||||
is_cylinder_used(&displayed_dive, index.row(), false)))) {
|
is_cylinder_used(&displayed_dive, index.row())))) {
|
||||||
emit warningMessage(TITLE_OR_TEXT(
|
emit warningMessage(TITLE_OR_TEXT(
|
||||||
tr("Cylinder cannot be removed"),
|
tr("Cylinder cannot be removed"),
|
||||||
tr("This gas is in use. Only cylinders that are not used in the dive can be removed.")));
|
tr("This gas is in use. Only cylinders that are not used in the dive can be removed.")));
|
||||||
|
|
Loading…
Add table
Reference in a new issue