summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-27 10:22:51 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-27 10:22:51 -0800
commitd2f9ee8d45ef9c87f0981f7b786a757f631b792b (patch)
tree17bffd80c9bd07752e474775d713da8cb02f4570 /dive.h
parent97a43003c461427b99e1aa0dfc165841bdeaf90e (diff)
downloadsubsurface-d2f9ee8d45ef9c87f0981f7b786a757f631b792b.tar.gz
Planner: don't use the planned dive for relative start time
The existing code has an embarrassing error in its logic. It picked the last dive in the table and made sure that the relative start time was either N minutes after 'now' or N minutes after the last dive ends, whichever is later. But once the planned dive has been added to the dive list (so once we have a first depth and time entry, that last dive now is the planned dive. And every time focus left the start time field the start time would be recalculated relative to the end of the dive we are currently planning. With this patch we instead simply remember the number of the last dive just as we create the dive plan and use that to look up the end time of previous dive. I could have just stored that end time but I figured maybe there could be other reasons to go back to the last dive before the planned dive, so this seemed cleaner. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/dive.h b/dive.h
index f6677ab2c..7e00a6ce6 100644
--- a/dive.h
+++ b/dive.h
@@ -647,6 +647,7 @@ struct divedatapoint {
struct diveplan {
timestamp_t when;
+ int lastdive_nr;
int surface_pressure; /* mbar */
int bottomsac; /* ml/min */
int decosac; /* ml/min */