mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Include the cylinder information in a dive added with "Add Dive"
We only copied the samples, but not the related cylinder data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f2035bcd79
commit
460aa4c1bd
3 changed files with 15 additions and 2 deletions
11
dive.c
11
dive.c
|
@ -195,7 +195,16 @@ struct dive *alloc_dive(void)
|
||||||
return dive;
|
return dive;
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_samples(struct dive* s, struct dive* d)
|
void copy_cylinders(struct dive *s, struct dive *d)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if (!s || !d)
|
||||||
|
return;
|
||||||
|
for (i = 0; i < MAX_CYLINDERS; i++)
|
||||||
|
d->cylinder[i] = s->cylinder[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
void copy_samples(struct dive *s, struct dive *d)
|
||||||
{
|
{
|
||||||
/* instead of carefully copying them one by one and calling add_sample
|
/* instead of carefully copying them one by one and calling add_sample
|
||||||
* over and over again, let's just copy the whole blob */
|
* over and over again, let's just copy the whole blob */
|
||||||
|
|
1
dive.h
1
dive.h
|
@ -653,6 +653,7 @@ extern unsigned int dc_airtemp(struct divecomputer *dc);
|
||||||
extern struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer_downloaded);
|
extern struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer_downloaded);
|
||||||
extern struct dive *try_to_merge(struct dive *a, struct dive *b, bool prefer_downloaded);
|
extern struct dive *try_to_merge(struct dive *a, struct dive *b, bool prefer_downloaded);
|
||||||
extern void renumber_dives(int nr);
|
extern void renumber_dives(int nr);
|
||||||
|
extern void copy_cylinders(struct dive *s, struct dive *d);
|
||||||
extern void copy_samples(struct dive *s, struct dive *d);
|
extern void copy_samples(struct dive *s, struct dive *d);
|
||||||
|
|
||||||
extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx);
|
extern void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int time, int idx);
|
||||||
|
|
|
@ -437,6 +437,7 @@ void DivePlannerPointsModel::loadFromDive(dive* d)
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH(const sample &s, backupSamples){
|
Q_FOREACH(const sample &s, backupSamples){
|
||||||
|
// we need to use the correct gas
|
||||||
plannerModel->addStop(s.depth.mm, s.time.seconds, tr("Air"), 0);
|
plannerModel->addStop(s.depth.mm, s.time.seconds, tr("Air"), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1190,8 +1191,10 @@ void DivePlannerPointsModel::createTemporaryPlan()
|
||||||
tempDive = NULL;
|
tempDive = NULL;
|
||||||
const char *errorString = NULL;
|
const char *errorString = NULL;
|
||||||
plan(&diveplan, &cache, &tempDive, isPlanner(), &errorString);
|
plan(&diveplan, &cache, &tempDive, isPlanner(), &errorString);
|
||||||
if (mode == ADD)
|
if (mode == ADD) {
|
||||||
copy_samples(tempDive, current_dive);
|
copy_samples(tempDive, current_dive);
|
||||||
|
copy_cylinders(tempDive, current_dive);
|
||||||
|
}
|
||||||
#if DEBUG_PLAN
|
#if DEBUG_PLAN
|
||||||
dump_plan(&diveplan);
|
dump_plan(&diveplan);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue