diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-03-11 11:17:05 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-11 11:42:57 -0700 |
commit | 74638c5f65e62c82439ee59d0e35541de0590265 (patch) | |
tree | cd7641f79ad9c05075180ef52ad8d0f78f7d05fc /qt-ui/profile | |
parent | ddff93f096be8e8c8670b9bf526ccf67545720af (diff) | |
download | subsurface-74638c5f65e62c82439ee59d0e35541de0590265.tar.gz |
Simplify the code that replaces a gas change event at t=0
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 68b1cbe70..66ef84ac4 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -1393,21 +1393,16 @@ void ProfileWidget2::changeGas() if (seconds == 0) { bool eventRemoved = false; - QString tempStr = "gaschange"; - char *gaschangeStr = tempStr.toUtf8().data(); - - struct event *gasChangeEvent = get_next_event(current_dc->events, gaschangeStr); - struct event *temp; - - while (gasChangeEvent) { - temp = get_next_event(current_dc->events, gaschangeStr); + struct event *gasChangeEvent = current_dc->events; + while ((gasChangeEvent = get_next_event(gasChangeEvent, "gaschange")) != NULL) { if (gasChangeEvent->time.seconds == 0) { remove_event(gasChangeEvent); eventRemoved = true; + gasChangeEvent = current_dc->events; + } else { + gasChangeEvent = gasChangeEvent->next; } - gasChangeEvent = temp; } - if (eventRemoved) { mark_divelist_changed(true); replot(); |