From 683dbe172cd9fcee0c23eb54b964167c509d3fff Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <helling@atdotde.de>
Date: Mon, 3 Nov 2014 22:37:59 +0100
Subject: [PATCH] Start with 0 when computing maxdepth when fixing up

This is needed to get the correct maxdepth when replanning
leads to a shallower dive.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
---
 dive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dive.c b/dive.c
index 73c7bd2..cb5fdc4 100644
--- a/dive.c
+++ b/dive.c
@@ -1102,7 +1102,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
 	double depthtime = 0;
 	int lasttime = 0;
 	int lastindex = -1;
-	int maxdepth = dc->maxdepth.mm;
+	int maxdepth = 0;
 	int mintemp = 0;
 	int lastdepth = 0;
 	int lastpressure = 0, lastdiluentpressure = 0;
@@ -1218,6 +1218,7 @@ struct dive *fixup_dive(struct dive *dive)
 
 	sanitize_cylinder_info(dive);
 	dive->maxcns = dive->cns;
+	dive->maxdepth.mm = 0;
 
 	for_each_dc (dive, dc)
 		fixup_dive_dc(dive, dc);
-- 
1.9.3 (Apple Git-50)

