diff options
Diffstat (limited to 'core/selection.cpp')
-rw-r--r-- | core/selection.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/selection.cpp b/core/selection.cpp index 48bb1a76f..d6267c78a 100644 --- a/core/selection.cpp +++ b/core/selection.cpp @@ -254,6 +254,18 @@ extern "C" void deselect_trip(struct dive_trip *trip) } } +extern "C" struct dive_trip *single_selected_trip() +{ + if (amount_trips_selected != 1) + return NULL; + for (int i = 0; i < trip_table.nr; ++i) { + if (trip_table.trips[i]->selected) + return trip_table.trips[i]; + } + fprintf(stderr, "warning: found no selected trip even though one should be selected\n"); + return NULL; // shouldn't happen +} + extern "C" void clear_selection(void) { current_dive = nullptr; |