diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-08-18 14:12:05 -0500 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-08-18 14:12:05 -0500 |
commit | 0f1381f1609af6b9e7a09b3423741a4e713fbff4 (patch) | |
tree | b5bf9b406bc52bf4469c527a1a2196bbc4a18795 /divelist.c | |
parent | 88fe28636e775ab9dfbb7caa769d63045dc4d7ca (diff) | |
download | subsurface-0f1381f1609af6b9e7a09b3423741a4e713fbff4.tar.gz |
Planner: assign a dive number if the right number seems obvious
Use the same logic as we do for newly added dives.
As a side effect this patch appears to fix the issues with getting the
newly planned dive selected.
Fixes #692
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/divelist.c b/divelist.c index 9fe3240d5..cccd3a0a6 100644 --- a/divelist.c +++ b/divelist.c @@ -1040,3 +1040,11 @@ void process_dives(bool is_imported, bool prefer_imported) mark_divelist_changed(true); } } + +void set_dive_nr_for_current_dive() +{ + if (dive_table.nr == 1) + current_dive->number = 1; + else if (selected_dive == dive_table.nr - 1 && get_dive(dive_table.nr - 2)->number) + current_dive->number = get_dive(dive_table.nr - 2)->number + 1; +} |