diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-11-27 19:39:10 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-28 23:58:35 +0100 |
commit | a95cc2b1c5bb9bb4f2ad73f00f06a8d35af50e93 (patch) | |
tree | 56fe700daeb274b1f68e0e35693f365164e86e10 /core | |
parent | b7806d1b945851a6a1713e7d619e1b3f4ddee464 (diff) | |
download | subsurface-a95cc2b1c5bb9bb4f2ad73f00f06a8d35af50e93.tar.gz |
Merging dives: Improve merging of divemaster, buddy and notes
Change the merging behavior for the following information:
Divemaster, buddy, suit:
From "(a) or (b)" to "a, b"
Notes:
From "(a) or (b)" to "a\n--\nb"
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/dive.c b/core/dive.c index 5255b655f..033139d0c 100644 --- a/core/dive.c +++ b/core/dive.c @@ -1716,7 +1716,7 @@ struct dive *fixup_dive(struct dive *dive) /* Don't pick a zero for MERGE_MIN() */ #define MERGE_MAX(res, a, b, n) res->n = MAX(a->n, b->n) #define MERGE_MIN(res, a, b, n) res->n = (a->n) ? (b->n) ? MIN(a->n, b->n) : (a->n) : (b->n) -#define MERGE_TXT(res, a, b, n) res->n = merge_text(a->n, b->n) +#define MERGE_TXT(res, a, b, n, sep) res->n = merge_text(a->n, b->n, sep) #define MERGE_NONZERO(res, a, b, n) res->n = a->n ? a->n : b->n struct sample *add_sample(struct sample *sample, int time, struct divecomputer *dc) @@ -1862,7 +1862,7 @@ static void merge_samples(struct divecomputer *res, struct divecomputer *a, stru } } -static char *merge_text(const char *a, const char *b) +static char *merge_text(const char *a, const char *b, const char *sep) { char *res; if (!a && !b) @@ -1876,7 +1876,7 @@ static char *merge_text(const char *a, const char *b) res = malloc(strlen(a) + strlen(b) + 32); if (!res) return (char *)a; - sprintf(res, translate("gettextFromC", "(%s) or (%s)"), a, b); + sprintf(res, "%s%s%s", a, sep, b); return res; } @@ -3268,11 +3268,11 @@ struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer res->when = dl ? dl->when : a->when; res->selected = a->selected || b->selected; merge_trip(res, a, b); - MERGE_TXT(res, a, b, notes); - MERGE_TXT(res, a, b, buddy); - MERGE_TXT(res, a, b, divemaster); + MERGE_TXT(res, a, b, notes, "\n--\n"); + MERGE_TXT(res, a, b, buddy, ", "); + MERGE_TXT(res, a, b, divemaster, ", "); MERGE_MAX(res, a, b, rating); - MERGE_TXT(res, a, b, suit); + MERGE_TXT(res, a, b, suit, ", "); MERGE_MAX(res, a, b, number); MERGE_NONZERO(res, a, b, cns); MERGE_NONZERO(res, a, b, visibility); |