aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/schedule.h
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2022-10-20 20:33:43 +0200
committerGravatar Tim Segers <tsegers@pm.me>2022-10-21 11:12:03 +0200
commit92dadbc1d4bacd5af4eb1b2e5bb3e6d2f0e954fa (patch)
tree70878418c3183f3a035ac6c865b0325db6ea9d0d /src/schedule.h
parent569ad230c20dce6b5db49b961e5198c490ba59fd (diff)
downloadopendeco-92dadbc1d4bacd5af4eb1b2e5bb3e6d2f0e954fa.tar.gz
Change waypoint callback from function-only to function+arg combination
Diffstat (limited to 'src/schedule.h')
-rw-r--r--src/schedule.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/schedule.h b/src/schedule.h
index e3b69ec..299217e 100644
--- a/src/schedule.h
+++ b/src/schedule.h
@@ -29,20 +29,23 @@ typedef enum segtype_t {
SEG_TRAVEL,
} segtype_t;
+typedef struct waypoint_callback_t {
+ void (*fn)(const decostate_t *ds, const waypoint_t, const segtype_t, void *arg);
+ void *arg;
+} waypoint_callback_t;
+
/* global variables */
extern int SWITCH_INTERMEDIATE;
/* functions */
-typedef void (*waypoint_callback_t)(const decostate_t *ds, const waypoint_t, const segtype_t);
-
const gas_t *best_gas(const double depth, const gas_t *gasses, const int nof_gasses);
int direct_ascent(const decostate_t *ds, const double depth, const double time, const gas_t *gas);
double calc_ndl(decostate_t *ds, const double depth, const double ascrate, const gas_t *gas);
-void simulate_dive(decostate_t *ds, waypoint_t *waypoints, const int nof_waypoints, waypoint_callback_t wp_cb);
+void simulate_dive(decostate_t *ds, waypoint_t *waypoints, const int nof_waypoints, waypoint_callback_t *wp_cb);
decoinfo_t calc_deco(decostate_t *ds, const double start_depth, const gas_t *start_gas, const gas_t *deco_gasses,
- const int nof_gasses, waypoint_callback_t wp_cb);
+ const int nof_gasses, waypoint_callback_t *wp_cb);
#endif /* end of include guard: SCHEDULE_H */