mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Better testing if the first gas is explicit
Given that we might be adding a gas change event at t = 0 we need to check for both that and t = time_or_first_sample. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0739da38c5
commit
e9e9996766
2 changed files with 5 additions and 2 deletions
|
@ -135,7 +135,9 @@ bool DiveEventItem::shouldBeHidden()
|
||||||
* Don't bother showing those
|
* Don't bother showing those
|
||||||
*/
|
*/
|
||||||
struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0];
|
struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0];
|
||||||
if (!strcmp(event->name, "gaschange") && first_sample && event->time.seconds == first_sample->time.seconds)
|
if (!strcmp(event->name, "gaschange") &&
|
||||||
|
(event->time.seconds == 0 ||
|
||||||
|
(first_sample && event->time.seconds == first_sample->time.seconds)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
for (int i = 0; i < evn_used; i++) {
|
for (int i = 0; i < evn_used; i++) {
|
||||||
|
|
|
@ -306,7 +306,8 @@ bool is_cylinder_used(struct dive *dive, int idx)
|
||||||
for_each_dc(dive, dc) {
|
for_each_dc(dive, dc) {
|
||||||
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 == dc->sample[0].time.seconds)
|
if (dc->sample && (event->time.seconds == 0 ||
|
||||||
|
(dc->samples && dc->sample[0].time.seconds == event->time.seconds)))
|
||||||
firstGasExplicit = true;
|
firstGasExplicit = true;
|
||||||
if (get_cylinder_index(dive, event) == idx)
|
if (get_cylinder_index(dive, event) == idx)
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue