mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Partial rewrite of the dive trip code
This introduces a new data structure for dive trips - reuseing the struct dive just got way too messy. The dive_trip_t datastructure now allows the code to remember if the trip was auto generated or if its time stamp changed when dives where added to the trip during auto generation. The algorithm also distinguishes between dives that were intentionally added to a trip (either in an XML file or by adding them to trip in the UI) and dives that were added to trips via autogen. Saving dives that were added to trips via autogen makes that assignment "intentional". With this partial rewrite several of the oddities of the old code should be resolved - especially turning autogen on and off again should get the divelist back to the previous stage. Also, when dives are merged during file open or import we now try to pick the correct tripflag (instead of just ignoring the tripflag completely and resetting it to TF_NONE by mistake). Finally, the dive trip debugging code got more verbose and is trying harder to detect issues at the earliest time possible. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bf83aa2104
commit
c804c4e02e
5 changed files with 136 additions and 50 deletions
5
dive.c
5
dive.c
|
|
@ -710,6 +710,11 @@ struct dive *try_to_merge(struct dive *a, struct dive *b)
|
|||
res = alloc_dive();
|
||||
|
||||
res->when = a->when;
|
||||
/* the larger tripflag is more relevant */
|
||||
if(a->tripflag > b->tripflag)
|
||||
res->tripflag = a->tripflag;
|
||||
else
|
||||
res->tripflag = b->tripflag;
|
||||
MERGE_NONZERO(res, a, b, latitude);
|
||||
MERGE_NONZERO(res, a, b, longitude);
|
||||
MERGE_TXT(res, a, b, location);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue