From 3611b0ae2d78402593b5bd007917454a4dcb9b50 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 9 Apr 2013 19:46:05 -0700 Subject: [PATCH] Automatically show Freshwater tag (but don't set it) If the salinity is 10000 we show (but do not set) the Freshwater tag. Signed-off-by: Dirk Hohndel --- dive.h | 1 + parse-xml.c | 1 - statistics.c | 8 +++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dive.h b/dive.h index eaf60d391..de0c58fca 100644 --- a/dive.h +++ b/dive.h @@ -44,6 +44,7 @@ #define DTAG_RIVER (1 << 12) #define DTAG_NIGHT (1 << 13) #define DTAG_FRESH (1 << 14) +#define DTAG_FRESH_NR 14 #define DTAG_NR 15 /* defined in statistics.c */ extern char *dtag_names[DTAG_NR]; diff --git a/parse-xml.c b/parse-xml.c index 57b022bb0..d72ad73e2 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -205,7 +205,6 @@ static void divetags(char *buffer, void *_tags) int *tags = _tags; int i; - *tags = 0; for (i = 0; i < DTAG_NR; i++) { if (strstr(buffer, dtag_names[i])) { /* stupidly we have 'cave' and 'cavern' */ diff --git a/statistics.c b/statistics.c index 241e5929d..52477468b 100644 --- a/statistics.c +++ b/statistics.c @@ -548,6 +548,7 @@ static void show_single_dive_stats(struct dive *dive) struct dive *prev_dive; struct tm tm; struct divecomputer *dc; + int more = 0; process_all_dives(dive, &prev_dive); if (!dive) @@ -643,7 +644,7 @@ static void show_single_dive_stats(struct dive *dive) /* Dive type */ *buf = '\0'; if (dive->dive_tags) { - int i, more = 0; + int i; for (i = 0; i < DTAG_NR; i++) if(dive->dive_tags & (1 << i)) { @@ -653,6 +654,11 @@ static void show_single_dive_stats(struct dive *dive) more = 1; } } + if (!(dive->dive_tags & DTAG_FRESH) && dc->salinity == 10000) { + if (more) + strcat(buf, ", "); + strcat(buf, _(dtag_names[DTAG_FRESH_NR])); + } set_label(single_w.dive_type, buf); }