From 15112712019817e4e64b5c35b7bb38315125e920 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 8 Feb 2013 20:44:04 -0800 Subject: 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 --- statistics.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'statistics.c') 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); -- cgit v1.2.3-70-g09d2