diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-11-05 15:56:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-11-13 20:50:10 -0800 |
commit | 1f8506ce645000bd158fcd3b2c9c799505c78bb2 (patch) | |
tree | e0a2b81e3198240d8cf16a59ef7ff00054dc5c18 /core/dive.c | |
parent | de81effb258c9c55af299ef48e79df4de941b391 (diff) | |
download | subsurface-1f8506ce645000bd158fcd3b2c9c799505c78bb2.tar.gz |
Display values in info box only if value is interesting
Type duration_t changed from uint to int.
Default value of '-1' introduced for some of the values in struct sample:
NDL used -1 as default.
Bearing uses -1 as default (no bearing set).
Display pXX, EAD, END, density, MOD only if values are larger than 0.
In profile don't display data from two first and two last plot_data
entries in info box.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/dive.c b/core/dive.c index fccfe4da9..9e3d42a44 100644 --- a/core/dive.c +++ b/core/dive.c @@ -753,6 +753,10 @@ struct sample *prepare_sample(struct divecomputer *dc) sample->sensor[0] = sample[-1].sensor[0]; sample->sensor[1] = sample[-1].sensor[1]; } + // Init some values with -1 + sample->bearing.degrees = -1; + sample->ndl.seconds = -1; + return sample; } return NULL; @@ -1261,12 +1265,12 @@ static void fixup_meandepth(struct dive *dive) static void fixup_duration(struct dive *dive) { struct divecomputer *dc; - unsigned int duration = 0; + duration_t duration = { }; for_each_dc (dive, dc) - duration = MAX(duration, dc->duration.seconds); + duration.seconds = MAX(duration.seconds, dc->duration.seconds); - dive->duration.seconds = duration; + dive->duration.seconds = duration.seconds; } /* |