summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-07 10:12:31 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-07 10:12:31 -0700
commitb49b081bb9c3938e5df201350a3a7d397c2c6216 (patch)
tree0fb28dc9756f18ce13011e5754882c789f444cf9 /dive.h
parent6ddf0e1d227bdf707469a2d7313ea850d35a6cda (diff)
downloadsubsurface-b49b081bb9c3938e5df201350a3a7d397c2c6216.tar.gz
Handle new dives correctly if trips exist
There is an interesting issue when adding new dives into a dive list with existing trips. Since fill_dive_list walks the list backwards and trips are determined by the timestamp of the first dive in a trip, it is non-trivial to know when a dive is added if it should be part of an existing trip or not. Let's say when we see the dive we can also see a trip entry that starts four days earlier. Without looking forward in the list of dives we cannot tell if this is a multi-day trip that this dive would fit into, or if there is a break of more than tree days (our current trip threshold). Instead this commit adds a second scan of the dives in chronological order that does the right thing for new dives. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/dive.h b/dive.h
index 29814c34e..42b5f771d 100644
--- a/dive.h
+++ b/dive.h
@@ -271,6 +271,7 @@ extern gboolean autogroup;
#define UNGROUPED_DIVE(_dive) ((_dive)->tripflag == NO_TRIP)
#define DIVE_IN_TRIP(_dive) ((_dive)->tripflag == IN_TRIP)
+#define DIVE_NEEDS_TRIP(_dive) ((_dive)->tripflag == TF_NONE)
#define NEXT_TRIP(_entry) ((_entry) ? g_list_next(_entry) : (dive_trip_list))
#define PREV_TRIP(_entry) ((_entry) ? g_list_previous(_entry) : g_list_last(dive_trip_list))
#define DIVE_TRIP(_trip) ((struct dive *)(_trip)->data)