mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: use ref-counts to see if dive site is used
Checking for dive site usage is now simply checking the number of dives. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e2df38d868
commit
9e9821551f
1 changed files with 9 additions and 11 deletions
|
@ -176,18 +176,16 @@ int nr_of_dives_at_dive_site(struct dive_site *ds, bool select_only)
|
|||
|
||||
bool is_dive_site_used(struct dive_site *ds, bool select_only)
|
||||
{
|
||||
int j;
|
||||
bool found = false;
|
||||
struct dive *d;
|
||||
if (!ds)
|
||||
return false;
|
||||
for_each_dive(j, d) {
|
||||
if (d->dive_site == ds && (!select_only || d->selected)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
int i;
|
||||
|
||||
if (!select_only)
|
||||
return ds->dives.nr > 0;
|
||||
|
||||
for (i = 0; i < ds->dives.nr; i++) {
|
||||
if (ds->dives.dives[i]->selected)
|
||||
return true;
|
||||
}
|
||||
return found;
|
||||
return false;
|
||||
}
|
||||
|
||||
void free_dive_site(struct dive_site *ds)
|
||||
|
|
Loading…
Add table
Reference in a new issue