From 23cfd907dea74dd8e4c8bbf93c8c3f598868623e Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 14 Feb 2013 09:44:18 -0800 Subject: Better handling of manually edited air temperature We now load and save this in the XML file, we do the right thing when merging dives and show the edited air temperature in the Dive Info notebook when a divecomputer doesn't have an air temperature. Signed-off-by: Dirk Hohndel --- save-xml.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'save-xml.c') diff --git a/save-xml.c b/save-xml.c index 22059a178..c0af41c4c 100644 --- a/save-xml.c +++ b/save-xml.c @@ -150,6 +150,21 @@ static void save_depths(FILE *f, struct divecomputer *dc) fputs(" />\n", f); } +static void save_dive_temperature(FILE *f, struct dive *dive) +{ + temperature_t temp; + temp.mkelvin = dive->airtemp.mkelvin; + dive->airtemp.mkelvin = 0; + fixup_airtemp(dive); + if (dive->airtemp.mkelvin && temp.mkelvin != dive->airtemp.mkelvin) { + fputs(" \n", f); + } + dive->airtemp.mkelvin = temp.mkelvin; + +} + static void save_temperatures(FILE *f, struct divecomputer *dc) { if (!dc->airtemp.mkelvin && !dc->watertemp.mkelvin) @@ -448,7 +463,7 @@ void save_dive(FILE *f, struct dive *dive) save_overview(f, dive); save_cylinder_info(f, dive); save_weightsystem_info(f, dive); - + save_dive_temperature(f, dive); /* Save the dive computer data */ dc = &dive->dc; do { -- cgit v1.2.3-70-g09d2