core: move get_dive_dc() to struct dive

Feels natural in a C++ code base.

This removes a nullptr-check so some care has to be taken.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-30 20:38:12 +02:00 committed by bstoeger
parent 731052c776
commit f1f082d86a
15 changed files with 59 additions and 55 deletions

View file

@ -663,7 +663,7 @@ void MainWindow::on_actionReplanDive_triggered()
if (!plannerStateClean() || !current_dive || !userMayChangeAppState())
return;
const struct divecomputer *dc = get_dive_dc(current_dive, profile->dc);
const struct divecomputer *dc = current_dive->get_dc(profile->dc);
if (!(is_dc_planner(dc) || is_dc_manually_added_dive(dc))) {
if (QMessageBox::warning(this, tr("Warning"), tr("Trying to replan a dive profile that has not been manually added."),
QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)