mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:33:24 +00:00
Prevent time travel in planner dive edit
If the user enters an absolute time that is before the previous waypoint, silently assume that this is a relative time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7e1f0d243b
commit
7a18edddbb
1 changed files with 3 additions and 2 deletions
|
@ -218,9 +218,10 @@ struct divedatapoint *get_nth_dp(struct diveplan *diveplan, int idx)
|
|||
void add_duration_to_nth_dp(struct diveplan *diveplan, int idx, int duration, gboolean is_rel)
|
||||
{
|
||||
struct divedatapoint *pdp, *dp = get_nth_dp(diveplan, idx);
|
||||
if (idx > 0 && is_rel) {
|
||||
if (idx > 0) {
|
||||
pdp = get_nth_dp(diveplan, idx - 1);
|
||||
duration += pdp->time;
|
||||
if (is_rel || dp->time <= pdp->time)
|
||||
duration += pdp->time;
|
||||
}
|
||||
dp->time = duration;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue