core: move set_weightsystem() to weightsystem_table

Feels natural in a C++ code base.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-07-01 22:55:39 +02:00 committed by bstoeger
parent 650fda3221
commit b5a4e7eb0b
3 changed files with 5 additions and 7 deletions

View file

@ -318,11 +318,11 @@ void weightsystem_table::add(int idx, weightsystem_t ws)
insert(begin() + idx, std::move(ws));
}
void set_weightsystem(struct dive *dive, int idx, weightsystem_t ws)
void weightsystem_table::set(int idx, weightsystem_t ws)
{
if (idx < 0 || static_cast<size_t>(idx) >= dive->weightsystems.size())
if (idx < 0 || static_cast<size_t>(idx) >= size())
return;
dive->weightsystems[idx] = std::move(ws);
(*this)[idx] = std::move(ws);
}
/* when planning a dive we need to make sure that all cylinders have a sane depth assigned