core: move cylinder related functions to struct dive

Seems natural in a C++ code base.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-06-25 07:43:32 +02:00 committed by bstoeger
parent 3aab33ba4c
commit 1b593dc56c
29 changed files with 250 additions and 259 deletions

View file

@ -84,14 +84,14 @@ void TankItem::setData(const struct dive *d, const struct divecomputer *dc, int
struct gasmix gasmix = gasmix_invalid;
const struct event *ev;
while ((ev = loop.next(*dc)) != nullptr && ev->time.seconds <= plotStartTime)
gasmix = get_gasmix_from_event(d, *ev);
gasmix = d->get_gasmix_from_event(*ev);
// work through all the gas changes and add the rectangle for each gas while it was used
int startTime = plotStartTime;
while (ev && (int)ev->time.seconds < plotEndTime) {
createBar(startTime, ev->time.seconds, gasmix);
startTime = ev->time.seconds;
gasmix = get_gasmix_from_event(d, *ev);
gasmix = d->get_gasmix_from_event(*ev);
ev = loop.next(*dc);
}
createBar(startTime, plotEndTime, gasmix);