mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn divecomputer list into std::vector<>
Since struct divecomputer is now fully C++ (i.e. cleans up after itself), we can simply turn the list of divecomputers into an std::vector<>. This makes the code quite a bit simpler, because the first divecomputer was actually a subobject. Yes, this makes the common case of a single divecomputer a little bit less efficient, but it really shouldn't matter. If it does, we can still write a special std::vector<>- like container that keeps the first element inline. This change makes pointers-to-divecomputers not stable. So always access the divecomputer via its index. As far as I can tell, most of the code already does this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e237f29fb2
commit
284582d2e8
54 changed files with 738 additions and 893 deletions
|
@ -70,7 +70,7 @@ void DivePlannerPointsModel::createSimpleDive(struct dive *dIn)
|
|||
clear_dive(d);
|
||||
d->id = dive_getUniqID();
|
||||
d->when = QDateTime::currentMSecsSinceEpoch() / 1000L + gettimezoneoffset() + 3600;
|
||||
make_planner_dc(&d->dc);
|
||||
make_planner_dc(&d->dcs[0]);
|
||||
|
||||
clear();
|
||||
removeDeco();
|
||||
|
@ -818,7 +818,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
|
|||
}
|
||||
}
|
||||
if (divemode == UNDEF_COMP_TYPE)
|
||||
divemode = get_dive_dc_const(d, dcNr)->divemode;
|
||||
divemode = get_dive_dc(d, dcNr)->divemode;
|
||||
|
||||
// add the new stop
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue