diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-11-18 11:15:32 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-11-20 08:14:54 -0800 |
commit | 6bf4120dbbf7be1b9267e0e86f3948b77870ea71 (patch) | |
tree | 3282a26502c1a91ae63ceca450b82b11f5be4e78 /core/divelist.c | |
parent | 3b9e0b59311908f6cbc099f3b7fd5294fd5d0d30 (diff) | |
download | subsurface-6bf4120dbbf7be1b9267e0e86f3948b77870ea71.tar.gz |
Core: replace tripflag by notrip boolean
The only remaining use of the tripflag was to mark dives that
were removed explicitly from a trip, i.e. shouldn't be autogrouped.
Therefore replace the enum by a simple boolean.
Currently, there is no way of unsetting the notrip flag. But this
shouldn't result in a user-visible change.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.c')
-rw-r--r-- | core/divelist.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/core/divelist.c b/core/divelist.c index f887cc82c..41036a65f 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -875,10 +875,6 @@ struct dive_trip *unregister_dive_from_trip(struct dive *dive, short was_autogen if (idx) unregister_dive_from_table(&trip->dives, idx); dive->divetrip = NULL; - if (was_autogen) - dive->tripflag = TF_NONE; - else - dive->tripflag = NO_TRIP; return trip; } @@ -896,7 +892,6 @@ void add_dive_to_trip(struct dive *dive, dive_trip_t *trip) remove_dive_from_trip(dive, false); add_dive_to_table(&trip->dives, -1, dive); dive->divetrip = trip; - dive->tripflag = IN_TRIP; } dive_trip_t *alloc_trip(void) @@ -981,7 +976,9 @@ dive_trip_t *get_dives_to_autogroup(int start, int *from, int *to, bool *allocat continue; } - if (!DIVE_NEEDS_TRIP(dive)) { + /* Only consider dives that have not been explicitly removed from + * a dive trip by the user. */ + if (dive->notrip) { lastdive = NULL; continue; } @@ -1002,7 +999,7 @@ dive_trip_t *get_dives_to_autogroup(int start, int *from, int *to, bool *allocat lastdive = dive; *from = i; for (*to = *from + 1; (dive = get_dive(*to)) != NULL; (*to)++) { - if (dive->divetrip || !DIVE_NEEDS_TRIP(dive) || + if (dive->divetrip || dive->notrip || dive->when >= lastdive->when + TRIP_THRESHOLD) break; if (get_dive_location(dive) && !trip->location) |