core: move add_to_weightsystem_table() to weightsystem_table

Feels natural in a C++ code base.

In analogy to other tables, this creates a struct that derives
from std::vector<>. This is generally frowned upon, but it works
and is the pragmatic thing for now. If someone wants to "fix" that,
they may just do it.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-07-01 21:54:59 +02:00 committed by bstoeger
parent 498302dcc6
commit 650fda3221
4 changed files with 8 additions and 7 deletions

View file

@ -1009,7 +1009,7 @@ RemoveWeight::RemoveWeight(int index, bool currentDiveOnly) :
void RemoveWeight::undo()
{
for (size_t i = 0; i < dives.size(); ++i) {
add_to_weightsystem_table(&dives[i]->weightsystems, indices[i], ws);
dives[i]->weightsystems.add(indices[i], ws);
emit diveListNotifier.weightAdded(dives[i], indices[i]);
dives[i]->invalidate_cache(); // Ensure that dive is written in git_save()
}