core: make calculate_cns() 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 22:23:57 +02:00 committed by bstoeger
parent f3b8e3c4aa
commit b34116e2e2
8 changed files with 68 additions and 67 deletions

View file

@ -10,11 +10,12 @@
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "dive.h"
#include "deco.h"
#include "dive.h"
#include "divelist.h"
#include "divelog.h"
#include "event.h"
#include "units.h"
#include "divelist.h"
#include "planner.h"
#include "range.h"
#include "gettext.h"
@ -409,7 +410,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
/* Print the CNS and OTU next.*/
dive->cns = 0;
dive->maxcns = 0;
update_cylinder_related_info(dive);
divelog.dives.update_cylinder_related_info(dive);
buf += casprintf_loc("<div>\n%s: %i%%", translate("gettextFromC", "CNS"), dive->cns);
buf += casprintf_loc("<br/>\n%s: %i<br/>\n</div>\n", translate("gettextFromC", "OTU"), dive->otu);