summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-11-20 20:09:52 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-20 11:22:40 -0800
commit746e6da75af471cf674133a1fb7fa6d9814c8f9e (patch)
treecf2c5c4ccd38d5f437415dec1371210cc854337d /planner.c
parentf6b29d093f51508312846c8dcf7e1f9e104d0796 (diff)
downloadsubsurface-746e6da75af471cf674133a1fb7fa6d9814c8f9e.tar.gz
Use add_gas_switch_event in instead of duplicate
There is a add_gas_switch_event, so don't duplicate the code. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/planner.c b/planner.c
index f104ad7b7..5ef66961b 100644
--- a/planner.c
+++ b/planner.c
@@ -267,11 +267,10 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan, const char **error
if (o2 != oldo2 || he != oldhe) {
int plano2 = (o2 + 5) / 10 * 10;
int planhe = (he + 5) / 10 * 10;
- int value;
- if (add_gas(dive, plano2, planhe) < 0)
+ int idx;
+ if (idx = add_gas(dive, plano2, planhe) < 0)
goto gas_error_exit;
- value = (plano2 / 10) | ((planhe / 10) << 16);
- add_event(dc, lasttime, 25, 0, value, "gaschange"); // SAMPLE_EVENT_GASCHANGE2
+ add_gas_switch_event(dive, dc, lasttime, idx);
oldo2 = o2; oldhe = he;
}
/* Create sample */