diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-02-14 09:44:18 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-02-14 09:44:18 -0800 |
commit | 23cfd907dea74dd8e4c8bbf93c8c3f598868623e (patch) | |
tree | 820717f6b5cb2614129c06b9b43ddff14ddd3efb /save-xml.c | |
parent | ca19578e407424221309f8724b451ffe2c1f9769 (diff) | |
download | subsurface-23cfd907dea74dd8e4c8bbf93c8c3f598868623e.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'save-xml.c')
-rw-r--r-- | save-xml.c | 17 |
1 files changed, 16 insertions, 1 deletions
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(" <divetemperature", f); + show_temperature(f, temp, " air='", "'"); + 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 { |