mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-02 23:20:20 +00:00
Properly merge dive buddies and divemaster information
When we merge dives, we didn't merge these fields properly. Do it. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d344d15a90
commit
50c2bb7c71
1 changed files with 5 additions and 2 deletions
7
dive.c
7
dive.c
|
@ -198,6 +198,7 @@ struct dive *fixup_dive(struct dive *dive)
|
||||||
/* Don't pick a zero for MERGE_MIN() */
|
/* Don't pick a zero for MERGE_MIN() */
|
||||||
#define MERGE_MAX(res, a, b, n) res->n = MAX(a->n, b->n)
|
#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_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)
|
||||||
|
|
||||||
static struct dive *add_sample(struct sample *sample, int time, struct dive *dive)
|
static struct dive *add_sample(struct sample *sample, int time, struct dive *dive)
|
||||||
{
|
{
|
||||||
|
@ -334,8 +335,10 @@ struct dive *try_to_merge(struct dive *a, struct dive *b)
|
||||||
res = alloc_dive();
|
res = alloc_dive();
|
||||||
|
|
||||||
res->when = a->when;
|
res->when = a->when;
|
||||||
res->location = merge_text(a->location, b->location);
|
MERGE_TXT(res, a, b, location);
|
||||||
res->notes = merge_text(a->notes, b->notes);
|
MERGE_TXT(res, a, b, notes);
|
||||||
|
MERGE_TXT(res, a, b, buddy);
|
||||||
|
MERGE_TXT(res, a, b, divemaster);
|
||||||
MERGE_MAX(res, a, b, number);
|
MERGE_MAX(res, a, b, number);
|
||||||
MERGE_MAX(res, a, b, maxdepth.mm);
|
MERGE_MAX(res, a, b, maxdepth.mm);
|
||||||
res->meandepth.mm = 0;
|
res->meandepth.mm = 0;
|
||||||
|
|
Loading…
Reference in a new issue