mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn event-list of divecomputer into std::vector<>
This is a rather long commit, because it refactors lots of the event code from pointer to value semantics: pointers to entries in an std::vector<> are not stable, so better use indexes. To step through the event-list at diven time stamps, add *_loop classes, which encapsulate state that had to be manually handled before by the caller. I'm not happy about the interface, but it tries to mirror the one we had before. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8ddc960fa0
commit
27dbdd35c6
36 changed files with 644 additions and 821 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "dive.h"
|
||||
#include "deco.h"
|
||||
#include "event.h"
|
||||
#include "units.h"
|
||||
#include "divelist.h"
|
||||
#include "planner.h"
|
||||
|
@ -570,18 +571,16 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
{
|
||||
dp = diveplan->dp;
|
||||
bool o2warning_exist = false;
|
||||
enum divemode_t current_divemode;
|
||||
double amb;
|
||||
const struct event *evd = NULL;
|
||||
current_divemode = UNDEF_COMP_TYPE;
|
||||
|
||||
divemode_loop loop(dive->dc);
|
||||
if (dive->dc.divemode != CCR) {
|
||||
while (dp) {
|
||||
if (dp->time != 0) {
|
||||
std::string temp;
|
||||
struct gasmix gasmix = get_cylinder(dive, dp->cylinderid)->gasmix;
|
||||
|
||||
current_divemode = get_current_divemode(&dive->dc, dp->time, &evd, ¤t_divemode);
|
||||
divemode_t current_divemode = loop.next(dp->time);
|
||||
amb = depth_to_atm(dp->depth.mm, dive);
|
||||
gas_pressures pressures = fill_pressures(amb, gasmix, (current_divemode == OC) ? 0.0 : amb * gasmix.o2.permille / 1000.0, current_divemode);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue