Editing air or water temperature should modify dive computer, not dive

The dive fields are summary fields, the actual data needs to be in the
divecomputer specific fields.

Fixes #307
This commit is contained in:
Dirk Hohndel 2013-11-29 12:05:21 -08:00
parent d936c55a01
commit ff5fa70a88
4 changed files with 25 additions and 11 deletions

View file

@ -153,13 +153,16 @@ static void save_depths(FILE *f, struct divecomputer *dc)
static void save_dive_temperature(FILE *f, struct dive *dive)
{
if (!dive->airtemp.mkelvin)
if (!dive->airtemp.mkelvin && !dive->watertemp.mkelvin)
return;
if (dive->airtemp.mkelvin == dc_airtemp(&dive->dc))
if (dive->airtemp.mkelvin == dc_airtemp(&dive->dc) || dive->watertemp.mkelvin == dc_watertemp(&dive->dc))
return;
fputs(" <divetemperature", f);
show_temperature(f, dive->airtemp, " air='", "'");
if (dive->airtemp.mkelvin && dive->airtemp.mkelvin != dc_airtemp(&dive->dc))
show_temperature(f, dive->airtemp, " air='", "'");
if (dive->watertemp.mkelvin && dive->watertemp.mkelvin != dc_watertemp(&dive->dc))
show_temperature(f, dive->watertemp, " water='", "'");
fputs("/>\n", f);
}