summaryrefslogtreecommitdiffstats
path: root/print.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-09 07:12:30 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-09 07:19:29 -0800
commitb9865d6bbc30ff4f82ffa17d4a2e3e74bc1054ed (patch)
tree0bb5aac0bd1f854ed3ee896b57d4ed73524ffad3 /print.c
parentc7efcb23a9a838f88c6691cb7b278126ae639c4b (diff)
downloadsubsurface-b9865d6bbc30ff4f82ffa17d4a2e3e74bc1054ed.tar.gz
Move duration to dive structure and replace accessor function
When starting on this quest to stop using the first divecomputer instead of data for the whole dive in commit eb73b5a528c8 ("Duration of a dive is the maximum duration from all divecomputers") I introduced an accessor function that calculates the dive duration on the fly as the maximum of the durations in the divecomputers. Since then Linus and I have added quite a few of the variables back to the dive data structure and it makes perfect sense to do the same thing for the duration as well and simply do the calculation once during fixup. This commit also replaces accesses to the first divecomputer in likely_same_dive to use the maxdepth and meandepth of the dive (those two slipped through the cracks in the previous commits, it seems). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'print.c')
-rw-r--r--print.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/print.c b/print.c
index 928fbb4d4..ec37675ac 100644
--- a/print.c
+++ b/print.c
@@ -101,7 +101,7 @@ static void show_dive_header(struct dive *dive, cairo_t *cr, double w,
snprintf(buffer, sizeof(buffer),
_("Max depth: %.*f %s\nDuration: %d min\n%s"),
decimals, depth, unit,
- (dive->dc.duration.seconds+59) / 60,
+ (dive->duration.seconds+59) / 60,
people);
set_font(layout, font, FONT_NORMAL*(1.5/w_scale_factor), PANGO_ALIGN_RIGHT);
pango_layout_set_text(layout, buffer, -1);
@@ -597,7 +597,7 @@ static void show_dive_table(struct dive *dive, cairo_t *cr, double w,
// Col 4: Time
len = snprintf(buffer, sizeof(buffer),
- _("%d min"),(dive->dc.duration.seconds+59) / 60);
+ _("%d min"),(dive->duration.seconds + 59) / 60);
cairo_move_to(cr, curwidth / PANGO_SCALE, 0);
pango_layout_set_width(layout, colwidth/ (double) 2);
pango_layout_set_text(layout, buffer, len);