core: make calculate_cns() member of dive_table

This function implicitely accessed the global divelog. To make
that explicit make it a member of dive_table, such that the
caller must access it via the global variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-18 22:23:57 +02:00 committed by bstoeger
parent f3b8e3c4aa
commit b34116e2e2
8 changed files with 68 additions and 67 deletions

View file

@ -22,16 +22,18 @@ struct dive_table : public sorted_owning_table<dive, &comp_dives> {
struct dive *register_dive(std::unique_ptr<dive> d);
std::unique_ptr<dive> unregister_dive(int idx);
int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_planner) const;
void update_cylinder_related_info(struct dive *) const;
int get_dive_nr_at_idx(int idx) const;
timestamp_t get_surface_interval(timestamp_t when) const;
struct dive *find_next_visible_dive(timestamp_t when);
private:
int calculate_cns(struct dive *dive) const; // Note: writes into dive->cns
};
/* this is used for both git and xml format */
#define DATAFORMAT_VERSION 3
extern void update_cylinder_related_info(struct dive *);
extern int init_decompression(struct deco_state *ds, const struct dive *dive, bool in_planner);
/* divelist core logic functions */
extern void process_loaded_dives();