mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
Change semantic for editing cylinders for multiple dives
Instead of trying to find matching cylinders, trigger on the cylinder number first and then only edit that n-th cylinder if it matches the one in the current dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
19b221d203
commit
3629a87fcc
2 changed files with 12 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
- core: when modifying cylinders across multiple dives, match cylinder number before comparing type
|
||||||
- core: merge all properties in a dive, including current, waveheight, etc
|
- core: merge all properties in a dive, including current, waveheight, etc
|
||||||
- core: prevent crash when merging dives without cylinders (as we might get when importing from divelogs.de)
|
- core: prevent crash when merging dives without cylinders (as we might get when importing from divelogs.de)
|
||||||
- core: work around bug in TecDiving dive computer reporting spurious 0 deg C water temperature in first sample
|
- core: work around bug in TecDiving dive computer reporting spurious 0 deg C water temperature in first sample
|
||||||
|
|
|
@ -1222,12 +1222,19 @@ EditCylinderBase::EditCylinderBase(int index, bool currentDiveOnly, bool nonProt
|
||||||
cyl.reserve(dives.size());
|
cyl.reserve(dives.size());
|
||||||
|
|
||||||
for (dive *d: dives) {
|
for (dive *d: dives) {
|
||||||
int idx = d == current ? index : find_cylinder_index(d, orig, sameCylinderFlags);
|
if (nonProtectedOnly && is_cylinder_prot(d, index))
|
||||||
if (idx < 0 || (nonProtectedOnly && is_cylinder_prot(d, idx)))
|
|
||||||
continue;
|
continue;
|
||||||
|
if (d != current &&
|
||||||
|
(!same_cylinder_size(orig, *get_cylinder(d, index)) || !same_cylinder_type(orig, *get_cylinder(d, index))))
|
||||||
|
// when editing cylinders, we assume that the user wanted to edit the 'n-th' cylinder
|
||||||
|
// and we only do edit that cylinder, if it was the same type as the one in the current dive
|
||||||
|
continue;
|
||||||
|
|
||||||
divesNew.push_back(d);
|
divesNew.push_back(d);
|
||||||
indexes.push_back(idx);
|
// that's silly as it's always the same value - but we need this vector of indices in the case where we add
|
||||||
cyl.push_back(clone_cylinder(*get_cylinder(d, idx)));
|
// a cylinder to several dives as the spot will potentially be different in different dives
|
||||||
|
indexes.push_back(index);
|
||||||
|
cyl.push_back(clone_cylinder(*get_cylinder(d, index)));
|
||||||
}
|
}
|
||||||
dives = std::move(divesNew);
|
dives = std::move(divesNew);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue