mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Set maxdepth correctly for dives with no samples
This showed up when suddenly some of the test dives no longer got merged when loaded twice. As I moved maxdepth up into the dive structure and added the code to fixup the data from what is in the divecomputer I missed the part where the function is exited early if there are no samples. This patch corrects that oversight. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9fa9ebcff2
commit
1b548c071b
1 changed files with 8 additions and 7 deletions
15
dive.c
15
dive.c
|
@ -661,14 +661,15 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
|
|||
asc_desc_time = duration/2;
|
||||
|
||||
dc->meandepth.mm = depth*(duration-asc_desc_time)/duration;
|
||||
return;
|
||||
if (depth > maxdepth)
|
||||
maxdepth = depth;
|
||||
} else {
|
||||
update_duration(&dc->duration, end - start);
|
||||
if (start != end)
|
||||
depthtime /= (end - start);
|
||||
|
||||
update_depth(&dc->meandepth, depthtime);
|
||||
}
|
||||
|
||||
update_duration(&dc->duration, end - start);
|
||||
if (start != end)
|
||||
depthtime /= (end - start);
|
||||
|
||||
update_depth(&dc->meandepth, depthtime);
|
||||
update_temperature(&dc->watertemp, mintemp);
|
||||
update_depth(&dc->maxdepth, maxdepth);
|
||||
if (maxdepth > dive->maxdepth.mm)
|
||||
|
|
Loading…
Reference in a new issue