From 36754d3399dab9155fac50e9451dcd325c7c73c0 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 2 Mar 2020 15:34:56 +0100 Subject: cleanup: move fill_default_cylinder from planner.c to equipment.c Moreover, move the declaration from dive.h to equipment.h. The result is a) more consistent and b) more logical. Signed-off-by: Berthold Stoeger --- core/planner.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'core/planner.c') diff --git a/core/planner.c b/core/planner.c index 0e26a9a57..204958a7e 100644 --- a/core/planner.c +++ b/core/planner.c @@ -175,37 +175,6 @@ static int tissue_at_end(struct deco_state *ds, struct dive *dive, struct deco_s return surface_interval; } - -/* if a default cylinder is set, use that */ -void fill_default_cylinder(const struct dive *dive, cylinder_t *cyl) -{ - const char *cyl_name = prefs.default_cylinder; - struct tank_info_t *ti = tank_info; - pressure_t pO2 = {.mbar = 1600}; - - if (!cyl_name) - return; - while (ti->name != NULL && ti < tank_info + MAX_TANK_INFO) { - if (strcmp(ti->name, cyl_name) == 0) - break; - ti++; - } - if (ti->name == NULL) - /* didn't find it */ - return; - cyl->type.description = strdup(ti->name); - if (ti->ml) { - cyl->type.size.mliter = ti->ml; - cyl->type.workingpressure.mbar = ti->bar * 1000; - } else { - cyl->type.workingpressure.mbar = psi_to_mbar(ti->psi); - if (ti->psi) - cyl->type.size.mliter = lrint(cuft_to_l(ti->cuft) * 1000 / bar_to_atm(psi_to_bar(ti->psi))); - } - // MOD of air - cyl->depth = gas_mod(cyl->gasmix, pO2, dive, 1); -} - /* calculate the new end pressure of the cylinder, based on its current end pressure and the * latest segment. */ static void update_cylinder_pressure(struct dive *d, int old_depth, int new_depth, int duration, int sac, cylinder_t *cyl, bool in_deco, enum divemode_t divemode) -- cgit v1.2.3-70-g09d2 From dee7fd9f308caae16045038b67dedd604a4d0ac2 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 2 Mar 2020 21:32:12 +0100 Subject: cleanup: use SAMPLE_EVENT_BOOKMARK in add_event() calls In two cases we were passing the magic value 8 instead of the symbolic SAMPLE_EVENT_BOOKMARK. Use the symbolic version instead. Signed-off-by: Berthold Stoeger --- core/planner.c | 2 +- profile-widget/profilewidget2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core/planner.c') diff --git a/core/planner.c b/core/planner.c index 204958a7e..a5f0d36bc 100644 --- a/core/planner.c +++ b/core/planner.c @@ -284,7 +284,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, } if (dp->divemode != type) { type = dp->divemode; - add_event(dc, lasttime, 8, 0, type, "modechange"); + add_event(dc, lasttime, SAMPLE_EVENT_BOOKMARK, 0, type, "modechange"); } /* Create sample */ diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp index 1b74f9d88..43ebf0777 100644 --- a/profile-widget/profilewidget2.cpp +++ b/profile-widget/profilewidget2.cpp @@ -1653,7 +1653,7 @@ void ProfileWidget2::addDivemodeSwitch() QPointF scenePos = mapToScene(mapFromGlobal(action->data().toPoint())); for (i = 0; i < NUM_DIVEMODE; i++) if (gettextFromC::tr(divemode_text_ui[i]) == action->text()) - add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), 8, 0, i, + add_event(current_dc, lrint(timeAxis->valueAt(scenePos)), SAMPLE_EVENT_BOOKMARK, 0, i, QT_TRANSLATE_NOOP("gettextFromC", "modechange")); invalidate_dive_cache(current_dive); mark_divelist_changed(true); -- cgit v1.2.3-70-g09d2