From 15b17a0acacedd97eb69336a933a9497d7cd1cc0 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 8 Mar 2024 11:29:11 +0100 Subject: [PATCH] planner: turn error argument of add_plan_to_notes() into a boolean flag This used to have multiple values, but is currently only checked for true/false. Reflect that in the type. Signed-off-by: Berthold Stoeger --- core/planner.cpp | 4 ++-- core/planner.h | 5 +---- core/plannernotes.cpp | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/core/planner.cpp b/core/planner.cpp index 3a6b50d40..4f80ffdb1 100644 --- a/core/planner.cpp +++ b/core/planner.cpp @@ -684,7 +684,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i bool o2break_next = false; int break_cylinder = -1, breakfrom_cylinder = 0; bool last_segment_min_switch = false; - int error = 0; + bool error = false; bool decodive = false; int first_stop_depth = 0; int laststoptime = timestep; @@ -1031,7 +1031,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i laststoptime = new_clock - clock; /* Finish infinite deco */ if (laststoptime >= 48 * 3600 && depth >= 6000) { - error = LONGDECO; + error = true; break; } diff --git a/core/planner.h b/core/planner.h index 0d65acf37..9f26cac37 100644 --- a/core/planner.h +++ b/core/planner.h @@ -2,9 +2,6 @@ #ifndef PLANNER_H #define PLANNER_H -#define LONGDECO 1 -#define NOT_RECREATIONAL 2 - #include "units.h" #include "divemode.h" @@ -44,7 +41,7 @@ extern int validate_gas(const char *text, struct gasmix *gas); extern int validate_po2(const char *text, int *mbar_po2); extern int get_cylinderid_at_time(struct dive *dive, struct divecomputer *dc, duration_t time); extern bool diveplan_empty(struct diveplan *diveplan); -extern void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error); +extern void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, bool error); extern const char *get_planner_disclaimer(); extern void free_dps(struct diveplan *diveplan); diff --git a/core/plannernotes.cpp b/core/plannernotes.cpp index 1ae0c5f0c..3848249f2 100644 --- a/core/plannernotes.cpp +++ b/core/plannernotes.cpp @@ -93,7 +93,7 @@ extern std::string get_planner_disclaimer_formatted() return format_string_std(get_planner_disclaimer(), deco); } -extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error) +extern "C" void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, bool error) { std::string buf; std::string icdbuf;