mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: move merge_dives() functios to struct dive_table
These functions have to access other dives in the list to calculate CNS, etc, so let's call them from there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8ec1f008ab
commit
4d7291d4a1
6 changed files with 178 additions and 163 deletions
12
core/dive.h
12
core/dive.h
|
|
@ -87,6 +87,7 @@ struct dive {
|
|||
|
||||
bool is_planned() const;
|
||||
bool is_logged() const;
|
||||
bool likely_same(const struct dive &b) const;
|
||||
|
||||
int depth_to_mbar(int depth) const;
|
||||
double depth_to_mbarf(int depth) const;
|
||||
|
|
@ -97,6 +98,9 @@ struct dive {
|
|||
|
||||
pressure_t calculate_surface_pressure() const;
|
||||
pressure_t un_fixup_surface_pressure() const;
|
||||
|
||||
/* Don't call directly, use dive_table::merge_dives()! */
|
||||
static std::unique_ptr<dive> create_merged_dive(const struct dive &a, const struct dive &b, int offset, bool prefer_downloaded);
|
||||
};
|
||||
|
||||
/* For the top-level list: an entry is either a dive or a trip */
|
||||
|
|
@ -184,14 +188,6 @@ extern bool dive_or_trip_less_than(struct dive_or_trip a, struct dive_or_trip b)
|
|||
extern int get_dive_salinity(const struct dive *dive);
|
||||
extern int dive_getUniqID();
|
||||
|
||||
struct merge_result {
|
||||
std::unique_ptr<struct dive> dive;
|
||||
dive_trip *trip;
|
||||
dive_site *site;
|
||||
};
|
||||
|
||||
extern merge_result merge_dives(const struct dive &a, const struct dive &b, int offset, bool prefer_downloaded);
|
||||
extern std::unique_ptr<dive> try_to_merge(const struct dive &a, const struct dive &b, bool prefer_downloaded);
|
||||
extern void copy_events_until(const struct dive *sd, struct dive *dd, int dcNr, int time);
|
||||
extern void copy_used_cylinders(const struct dive *s, struct dive *d, bool used_only);
|
||||
extern bool is_cylinder_used(const struct dive *dive, int idx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue