aboutsummaryrefslogtreecommitdiffstats
path: root/statistics.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-08 20:44:04 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-08 20:44:04 -0800
commit15112712019817e4e64b5c35b7bb38315125e920 (patch)
treed09295d8284cb8978815d6b38784341fee636e10 /statistics.c
parentb8c7992bbfe03dce665cbd5ba6144b0c8b59b6fd (diff)
downloadsubsurface-15112712019817e4e64b5c35b7bb38315125e920.tar.gz
Add maxdepth back to the dive structure
Populate during dive fixup as the maximum depth shown by all the divecomputers. Use this value (instead of the one in the first divecomputer) in printing, statistics, etc. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'statistics.c')
-rw-r--r--statistics.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/statistics.c b/statistics.c
index c08324d54..5c6777f8a 100644
--- a/statistics.c
+++ b/statistics.c
@@ -135,10 +135,10 @@ static void process_dive(struct dive *dp, stats_t *stats)
stats->longest_time.seconds = duration;
if (stats->shortest_time.seconds == 0 || duration < stats->shortest_time.seconds)
stats->shortest_time.seconds = duration;
- if (dp->dc.maxdepth.mm > stats->max_depth.mm)
- stats->max_depth.mm = dp->dc.maxdepth.mm;
- if (stats->min_depth.mm == 0 || dp->dc.maxdepth.mm < stats->min_depth.mm)
- stats->min_depth.mm = dp->dc.maxdepth.mm;
+ if (dp->maxdepth.mm > stats->max_depth.mm)
+ stats->max_depth.mm = dp->maxdepth.mm;
+ if (stats->min_depth.mm == 0 || dp->maxdepth.mm < stats->min_depth.mm)
+ stats->min_depth.mm = dp->maxdepth.mm;
process_temperatures(dp, stats);
@@ -415,7 +415,7 @@ static void process_all_dives(struct dive *dive, struct dive **prev_dive)
memset(&stats, 0, sizeof(stats));
if (dive_table.nr > 0) {
stats.shortest_time.seconds = get_duration_in_sec(dive_table.dives[0]);
- stats.min_depth.mm = dive_table.dives[0]->dc.maxdepth.mm;
+ stats.min_depth.mm = dive_table.dives[0]->maxdepth.mm;
stats.selection_size = dive_table.nr;
}
@@ -554,7 +554,7 @@ static void show_single_dive_stats(struct dive *dive)
get_time_string(dive->when - (prev_dive->when + get_duration_in_sec(prev_dive)), 4));
else
set_label(single_w.surf_intv, _("unknown"));
- value = get_depth_units(dive->dc.maxdepth.mm, &decimals, &unit);
+ value = get_depth_units(dive->maxdepth.mm, &decimals, &unit);
set_label(single_w.max_depth, "%.*f %s", decimals, value, unit);
value = get_depth_units(dive->dc.meandepth.mm, &decimals, &unit);
set_label(single_w.avg_depth, "%.*f %s", decimals, value, unit);