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

@ -105,17 +105,6 @@ std::unique_ptr<dive> dive_table::default_dive()
return d;
}
int total_weight(const struct dive *dive)
{
int total_grams = 0;
if (dive) {
for (auto &ws: dive->weightsystems)
total_grams += ws.weight.grams;
}
return total_grams;
}
static int active_o2(const struct dive &dive, const struct divecomputer *dc, duration_t time)
{
struct gasmix gas = dive.get_gasmix_at_time(*dc, time);