summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Jan Schubert <Jan.Schubert@GMX.li>2013-01-14 23:53:38 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-14 20:12:40 -0800
commit90d3c5614a9c952a50e582e2dff6e21419c64729 (patch)
tree5298138cc67579e4e58f33e493c53a8dae05ad37 /planner.c
parent2e53a415257677fe6e5da7fcce373722269a9082 (diff)
downloadsubsurface-90d3c5614a9c952a50e582e2dff6e21419c64729.tar.gz
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>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/planner.c b/planner.c
index dc5e53406..4389aac50 100644
--- a/planner.c
+++ b/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);