mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Centralising and redefining values as integers
This patch centralizes the definition for surface pressure, oxygen in air, (re)defines all such values as plain integers and adapts calculations. It eliminates 11 (!) occurrences of definitions for surface pressure and also a few for oxygen in air. It also rewrites the calculation for EAD, END and EADD using the new definitons, harmonizing it for OC and CC and fixes a bug for EADD OC calculation. And finally it removes the unneeded variable entry_ead in gtk-gui.c. Jan Signed-off-by: Jan Schubert <Jan.Schubert@GMX.li> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2e53a41525
commit
90d3c5614a
11 changed files with 51 additions and 48 deletions
10
planner.c
10
planner.c
|
@ -162,7 +162,7 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan)
|
|||
struct dive *dive;
|
||||
struct divedatapoint *dp;
|
||||
struct divecomputer *dc;
|
||||
int oldo2 = AIR_PERMILLE, oldhe = 0;
|
||||
int oldo2 = O2_IN_AIR, oldhe = 0;
|
||||
int lasttime = 0;
|
||||
|
||||
if (!diveplan || !diveplan->dp)
|
||||
|
@ -425,7 +425,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep)
|
|||
int *stoplevels;
|
||||
|
||||
if (!diveplan->surface_pressure)
|
||||
diveplan->surface_pressure = 1013;
|
||||
diveplan->surface_pressure = SURFACE_PRESSURE;
|
||||
if (*divep)
|
||||
delete_single_dive(dive_table.nr - 1);
|
||||
*divep = dive = create_dive_from_plan(diveplan);
|
||||
|
@ -566,7 +566,7 @@ static int validate_gas(const char *text, int *o2_p, int *he_p)
|
|||
return 0;
|
||||
|
||||
if (!strcasecmp(text, "air")) {
|
||||
o2 = AIR_PERMILLE; he = 0; text += 3;
|
||||
o2 = O2_IN_AIR; he = 0; text += 3;
|
||||
} else if (!strncasecmp(text, "ean", 3)) {
|
||||
o2 = get_permille(text+3, &text); he = 0;
|
||||
} else {
|
||||
|
@ -909,7 +909,7 @@ void input_plan()
|
|||
{
|
||||
GtkWidget *planner, *content, *vbox, *hbox, *outervbox, *add_row, *deltat, *label, *surfpres;
|
||||
char starttimebuf[64] = "+60:00";
|
||||
char pressurebuf[64] = "1013";
|
||||
char pressurebuf[64] = SURFACE_PRESSURE_STRING;
|
||||
|
||||
if (diveplan.dp)
|
||||
free_dps(diveplan.dp);
|
||||
|
@ -950,7 +950,7 @@ void input_plan()
|
|||
gtk_widget_add_events(surfpres, GDK_FOCUS_CHANGE_MASK);
|
||||
g_signal_connect(surfpres, "focus-out-event", G_CALLBACK(surfpres_focus_out_cb), NULL);
|
||||
diveplan.when = time(NULL) + 3600;
|
||||
diveplan.surface_pressure = 1013;
|
||||
diveplan.surface_pressure = SURFACE_PRESSURE;
|
||||
nr_waypoints = 4;
|
||||
add_waypoint_widgets(vbox, 0);
|
||||
add_waypoint_widgets(vbox, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue