mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move duration to dive structure and replace accessor function
When starting on this quest to stop using the first divecomputer instead of data for the whole dive in commit eb73b5a528c8 ("Duration of a dive is the maximum duration from all divecomputers") I introduced an accessor function that calculates the dive duration on the fly as the maximum of the durations in the divecomputers. Since then Linus and I have added quite a few of the variables back to the dive data structure and it makes perfect sense to do the same thing for the duration as well and simply do the calculation once during fixup. This commit also replaces accesses to the first divecomputer in likely_same_dive to use the maxdepth and meandepth of the dive (those two slipped through the cracks in the previous commits, it seems). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c7efcb23a9
commit
b9865d6bbc
6 changed files with 32 additions and 31 deletions
2
dive.h
2
dive.h
|
@ -323,6 +323,7 @@ struct dive {
|
|||
temperature_t mintemp, maxtemp;
|
||||
depth_t maxdepth, meandepth;
|
||||
pressure_t surface_pressure;
|
||||
duration_t duration;
|
||||
int salinity; // kg per 10000 l
|
||||
|
||||
struct divecomputer dc;
|
||||
|
@ -557,7 +558,6 @@ extern void report_dives(gboolean imported, gboolean prefer_imported);
|
|||
extern struct dive *fixup_dive(struct dive *dive);
|
||||
extern struct dive *merge_dives(struct dive *a, struct dive *b, int offset, gboolean prefer_downloaded);
|
||||
extern struct dive *try_to_merge(struct dive *a, struct dive *b, gboolean prefer_downloaded);
|
||||
extern int get_duration_in_sec(struct dive *dive);
|
||||
extern void renumber_dives(int nr);
|
||||
|
||||
extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue