core: move total_weight() into struct dive

Feels natural in a C++ code base.

Change the function to return a weight_t. Sadly, use of the
units.h types is very inconsistent and many parts of the code
use int or double instead. So let's try to make this consistent.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-30 11:13:39 +02:00 committed by bstoeger
parent df1affc25b
commit d36fd79527
9 changed files with 22 additions and 34 deletions

View file

@ -104,6 +104,7 @@ struct dive {
struct gasmix get_gasmix_at_time(const struct divecomputer &dc, duration_t time) const;
cylinder_t *get_cylinder(int idx);
const cylinder_t *get_cylinder(int idx) const;
weight_t total_weight() const;
int depth_to_mbar(int depth) const;
double depth_to_mbarf(int depth) const;
@ -202,10 +203,6 @@ extern struct event create_gas_switch_event(struct dive *dive, struct divecomput
extern void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, int *mean, int *duration);
extern bool cylinder_with_sensor_sample(const struct dive *dive, int cylinder_id);
/* UI related protopypes */
extern int total_weight(const struct dive *);
extern void update_setpoint_events(const struct dive *dive, struct divecomputer *dc);
/* Make pointers to dive and dive_trip "Qt metatypes" so that they can be passed through