mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Don't allow two gas changes at the same time
t = 0 isn't really special here. We shouldn't allow two gas changes at the same time, period. We also can do away with the special handling to mark the dive list changed and replot things if a gas change gets removed. That's done at the end of this function either way. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e121b4b548
commit
0739da38c5
1 changed files with 8 additions and 16 deletions
|
@ -1394,24 +1394,16 @@ void ProfileWidget2::changeGas()
|
|||
// no gas changes before the dive starts
|
||||
seconds = seconds > 0 ?: 0;
|
||||
|
||||
if (seconds == 0) {
|
||||
bool eventRemoved = false;
|
||||
// if there is a gas change at this time stamp, remove it before adding the new one
|
||||
struct event *gasChangeEvent = current_dc->events;
|
||||
while ((gasChangeEvent = get_next_event(gasChangeEvent, "gaschange")) != NULL) {
|
||||
if (gasChangeEvent->time.seconds == 0) {
|
||||
if (gasChangeEvent->time.seconds == seconds) {
|
||||
remove_event(gasChangeEvent);
|
||||
eventRemoved = true;
|
||||
gasChangeEvent = current_dc->events;
|
||||
} else {
|
||||
gasChangeEvent = gasChangeEvent->next;
|
||||
}
|
||||
}
|
||||
if (eventRemoved) {
|
||||
mark_divelist_changed(true);
|
||||
replot();
|
||||
}
|
||||
}
|
||||
|
||||
validate_gas(gas.toUtf8().constData(), &gasmix);
|
||||
QRegExp rx("\\(\\D*(\\d+)");
|
||||
int tank;
|
||||
|
|
Loading…
Add table
Reference in a new issue