mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Updated strategy for removing cylinders
Change the strategy when to allow cylinder removal from a dive: - Not remove when cylinder has gas switch events, in any other cases allow removal - Remove this whole "cylinder with same gas" thing being a criteria for cylinder removal When removing a cylinder which has corresponding pressure info in samples, also remove this pressure info from the samples. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
parent
cd5e17cf79
commit
4cbf8b87a3
5 changed files with 42 additions and 37 deletions
14
core/dive.c
14
core/dive.c
|
|
@ -2072,7 +2072,7 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, int
|
|||
if (mapping[0] > 0)
|
||||
add_initial_gaschange(dive, dc);
|
||||
|
||||
/* Remap the sensor indexes */
|
||||
/* Remap or delete the sensor indexes */
|
||||
for (i = 0; i < dc->samples; i++) {
|
||||
struct sample *s = dc->sample + i;
|
||||
int j;
|
||||
|
|
@ -2081,8 +2081,18 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, int
|
|||
int sensor;
|
||||
|
||||
sensor = mapping[s->sensor[j]];
|
||||
if (sensor >= 0)
|
||||
if (sensor == -1) {
|
||||
// Remove sensor and gas pressure info
|
||||
if (i == 0) {
|
||||
s->sensor[j] = 0;
|
||||
s->pressure[j].mbar = 0;
|
||||
} else {
|
||||
s->sensor[j] = s[-1].sensor[j];
|
||||
s->pressure[j].mbar = s[-1].pressure[j].mbar;
|
||||
}
|
||||
} else {
|
||||
s->sensor[j] = sensor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue