summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-07 08:13:23 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-07 08:13:23 -0800
commit85ed689dc0d6ab07386153151f6ac232adb91a8f (patch)
tree6dc5946cb20487e6e3ffca1cc6b439064480a1ab /planner.c
parentd281ad84fdce7990a09402c212885c7268ad8bd9 (diff)
downloadsubsurface-85ed689dc0d6ab07386153151f6ac232adb91a8f.tar.gz
Support relative times in diveplanner input "on the fly" mode
This had gotten lost when updating the profile on the fly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index 13a36e62b..fab5996ce 100644
--- a/planner.c
+++ b/planner.c
@@ -179,9 +179,13 @@ struct divedatapoint *get_nth_dp(struct diveplan *diveplan, int idx)
return dp;
}
-void add_duration_to_nth_dp(struct diveplan *diveplan, int idx, int duration)
+void add_duration_to_nth_dp(struct diveplan *diveplan, int idx, int duration, gboolean is_rel)
{
- struct divedatapoint *dp = get_nth_dp(diveplan, idx);
+ struct divedatapoint *pdp, *dp = get_nth_dp(diveplan, idx);
+ if (idx > 0 && is_rel) {
+ pdp = get_nth_dp(diveplan, idx - 1);
+ duration += pdp->time;
+ }
dp->time = duration;
}