mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Merge branch 'subsurface:master' into qt6devel
This commit is contained in:
commit
9bd1631103
2 changed files with 8 additions and 4 deletions
|
@ -1210,7 +1210,9 @@ static void merge_samples(struct divecomputer &res,
|
||||||
/* Only samples from b? */
|
/* Only samples from b? */
|
||||||
if (at < 0) {
|
if (at < 0) {
|
||||||
add_sample_b:
|
add_sample_b:
|
||||||
merge_one_sample(*bs, res);
|
struct sample sample = *bs;
|
||||||
|
sample.time.seconds += offset;
|
||||||
|
merge_one_sample(sample, res);
|
||||||
renumber_last_sample(res, cylinders_map_b);
|
renumber_last_sample(res, cylinders_map_b);
|
||||||
bs++;
|
bs++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1223,6 +1225,7 @@ static void merge_samples(struct divecomputer &res,
|
||||||
|
|
||||||
/* same-time sample: add a merged sample. Take the non-zero ones */
|
/* same-time sample: add a merged sample. Take the non-zero ones */
|
||||||
struct sample sample = *bs;
|
struct sample sample = *bs;
|
||||||
|
sample.time.seconds += offset;
|
||||||
sample_renumber(sample, nullptr, cylinders_map_b);
|
sample_renumber(sample, nullptr, cylinders_map_b);
|
||||||
if (as->depth.mm)
|
if (as->depth.mm)
|
||||||
sample.depth = as->depth;
|
sample.depth = as->depth;
|
||||||
|
@ -2112,8 +2115,7 @@ static void copy_dive_computer(struct divecomputer &res, const struct divecomput
|
||||||
*/
|
*/
|
||||||
static void interleave_dive_computers(struct dive &res,
|
static void interleave_dive_computers(struct dive &res,
|
||||||
const struct dive &a, const struct dive &b,
|
const struct dive &a, const struct dive &b,
|
||||||
const int cylinders_map_a[], const int cylinders_map_b[],
|
const int cylinders_map_a[], const int cylinders_map_b[])
|
||||||
int offset)
|
|
||||||
{
|
{
|
||||||
res.dcs.clear();
|
res.dcs.clear();
|
||||||
for (const auto &dc1: a.dcs) {
|
for (const auto &dc1: a.dcs) {
|
||||||
|
@ -2122,6 +2124,7 @@ static void interleave_dive_computers(struct dive &res,
|
||||||
copy_dive_computer(newdc, dc1);
|
copy_dive_computer(newdc, dc1);
|
||||||
const divecomputer *match = find_matching_computer(dc1, b);
|
const divecomputer *match = find_matching_computer(dc1, b);
|
||||||
if (match) {
|
if (match) {
|
||||||
|
int offset = match->when - dc1.when;
|
||||||
merge_events(res, newdc, dc1, *match, cylinders_map_a, cylinders_map_b, offset);
|
merge_events(res, newdc, dc1, *match, cylinders_map_a, cylinders_map_b, offset);
|
||||||
merge_samples(newdc, dc1, *match, cylinders_map_a, cylinders_map_b, offset);
|
merge_samples(newdc, dc1, *match, cylinders_map_a, cylinders_map_b, offset);
|
||||||
merge_extra_data(newdc, dc1, *match);
|
merge_extra_data(newdc, dc1, *match);
|
||||||
|
@ -2227,7 +2230,7 @@ std::unique_ptr<dive> dive::create_merged_dive(const struct dive &a, const struc
|
||||||
/* If we prefer downloaded, do those first, and get rid of "might be same" computers */
|
/* If we prefer downloaded, do those first, and get rid of "might be same" computers */
|
||||||
join_dive_computers(*res, b, a, cylinders_map_b.get(), cylinders_map_a.get(), true);
|
join_dive_computers(*res, b, a, cylinders_map_b.get(), cylinders_map_a.get(), true);
|
||||||
} else if (offset && might_be_same_device(a.dcs[0], b.dcs[0])) {
|
} else if (offset && might_be_same_device(a.dcs[0], b.dcs[0])) {
|
||||||
interleave_dive_computers(*res, a, b, cylinders_map_a.get(), cylinders_map_b.get(), offset);
|
interleave_dive_computers(*res, a, b, cylinders_map_a.get(), cylinders_map_b.get());
|
||||||
} else {
|
} else {
|
||||||
join_dive_computers(*res, a, b, cylinders_map_a.get(), cylinders_map_b.get(), false);
|
join_dive_computers(*res, a, b, cylinders_map_a.get(), cylinders_map_b.get(), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1182,6 +1182,7 @@ merge_result dive_table::merge_dives(const struct dive &a_in, const struct dive
|
||||||
* Keep the dive site, but add the GPS data */
|
* Keep the dive site, but add the GPS data */
|
||||||
res.site->location = b->dive_site->location;
|
res.site->location = b->dive_site->location;
|
||||||
}
|
}
|
||||||
|
res.dive->dive_site = res.site;
|
||||||
fixup_dive(*res.dive);
|
fixup_dive(*res.dive);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Reference in a new issue