summaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2013-10-11 18:53:29 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-10-11 10:19:29 -0700
commitc585d1ed02ce9aa87e2d06c5491171f13e0ed4ba (patch)
tree1dbfa829686c214b3c89112b3e2c8ba18f523e25 /profile.c
parentdd3b8210a98c081e342f8c972a1b3ba58c7ae5a3 (diff)
downloadsubsurface-c585d1ed02ce9aa87e2d06c5491171f13e0ed4ba.tar.gz
Remove some arguments, that we find in plot_data
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/profile.c b/profile.c
index a12ca55b8..c3b984199 100644
--- a/profile.c
+++ b/profile.c
@@ -1140,14 +1140,14 @@ struct divecomputer *select_dc(struct divecomputer *main)
}
static void plot_string(struct plot_data *entry, char *buf, int bufsize,
- int depth, int pressure, int temp, bool has_ndl)
+ bool has_ndl)
{
int pressurevalue, mod, ead, end, eadd;
const char *depth_unit, *pressure_unit, *temp_unit, *vertical_speed_unit;
char *buf2 = malloc(bufsize);
double depthvalue, tempvalue, speedvalue;
- depthvalue = get_depth_units(depth, NULL, &depth_unit);
+ depthvalue = get_depth_units(entry->depth, NULL, &depth_unit);
snprintf(buf, bufsize, translate("gettextFromC","D:%.1f %s"), depthvalue, depth_unit);
if (prefs.show_time) {
@@ -1155,13 +1155,13 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
snprintf(buf, bufsize, translate("gettextFromC","%s\nT:%d:%02d"), buf2, FRACTION(entry->sec, 60));
}
- if (pressure) {
- pressurevalue = get_pressure_units(pressure, &pressure_unit);
+ if (GET_PRESSURE(entry)) {
+ pressurevalue = get_pressure_units(GET_PRESSURE(entry), &pressure_unit);
memcpy(buf2, buf, bufsize);
snprintf(buf, bufsize, translate("gettextFromC","%s\nP:%d %s"), buf2, pressurevalue, pressure_unit);
}
- if (temp) {
- tempvalue = get_temp_units(temp, &temp_unit);
+ if (entry->temperature) {
+ tempvalue = get_temp_units(entry->temperature, &temp_unit);
memcpy(buf2, buf, bufsize);
snprintf(buf, bufsize, translate("gettextFromC","%s\nT:%.1f %s"), buf2, tempvalue, temp_unit);
}
@@ -1257,21 +1257,16 @@ static void plot_string(struct plot_data *entry, char *buf, int bufsize,
void get_plot_details(struct graphics_context *gc, int time, char *buf, int bufsize)
{
struct plot_info *pi = &gc->pi;
- int pressure = 0, temp = 0;
struct plot_data *entry = NULL;
int i;
for (i = 0; i < pi->nr; i++) {
entry = pi->entry + i;
- if (entry->temperature)
- temp = entry->temperature;
- if (GET_PRESSURE(entry))
- pressure = GET_PRESSURE(entry);
if (entry->sec >= time)
break;
}
if (entry)
- plot_string(entry, buf, bufsize, entry->depth, pressure, temp, pi->has_ndl);
+ plot_string(entry, buf, bufsize, pi->has_ndl);
}
/* Compare two plot_data entries and writes the results into a string */