mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: remove dc_number access from models
Instead of accessing the global dc_number from the DivePlannerPointsModel and the CylinderModel, pass them in the respective initialization functions. The dc_number global might not make sense on mobile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d057af43b4
commit
832398180c
7 changed files with 20 additions and 14 deletions
|
@ -105,9 +105,10 @@ void DivePlannerPointsModel::setupStartTime()
|
|||
}
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::loadFromDive(dive *dIn)
|
||||
void DivePlannerPointsModel::loadFromDive(dive *dIn, int dcNrIn)
|
||||
{
|
||||
d = dIn;
|
||||
dcNr = dcNrIn;
|
||||
|
||||
int depthsum = 0;
|
||||
int samplecount = 0;
|
||||
|
@ -115,7 +116,7 @@ void DivePlannerPointsModel::loadFromDive(dive *dIn)
|
|||
struct divecomputer *dc = &(d->dc);
|
||||
const struct event *evd = NULL;
|
||||
enum divemode_t current_divemode = UNDEF_COMP_TYPE;
|
||||
cylinders.updateDive(d);
|
||||
cylinders.updateDive(d, dcNr);
|
||||
duration_t lasttime = { 0 };
|
||||
duration_t lastrecordedtime = {};
|
||||
duration_t newtime = {};
|
||||
|
@ -197,7 +198,7 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
reset_cylinders(d, true);
|
||||
|
||||
if (d->cylinders.nr > 0) {
|
||||
cylinders.updateDive(d);
|
||||
cylinders.updateDive(d, dcNr);
|
||||
return; // We have at least one cylinder
|
||||
}
|
||||
}
|
||||
|
@ -215,7 +216,7 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
add_cylinder(&d->cylinders, 0, cyl);
|
||||
}
|
||||
reset_cylinders(d, false);
|
||||
cylinders.updateDive(d);
|
||||
cylinders.updateDive(d, dcNr);
|
||||
}
|
||||
|
||||
// Update the dive's maximum depth. Returns true if max. depth changed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue