core: make get_dive_nr_at_idx() 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 21:07:58 +02:00 committed by bstoeger
parent cce5f5950c
commit 271df8962b
3 changed files with 7 additions and 14 deletions

View file

@ -419,7 +419,7 @@ AddDive::AddDive(dive *d, bool autogroup, bool newNumber)
int idx = divelog.dives.get_insertion_index(divePtr.get());
if (newNumber)
divePtr->number = get_dive_nr_at_idx(idx);
divePtr->number = divelog.dives.get_dive_nr_at_idx(idx);
divesToAdd.dives.push_back({ std::move(divePtr), trip, site });
if (allocTrip)