diff options
-rw-r--r-- | save-xml.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/save-xml.c b/save-xml.c index 173f6a8ec..58f274722 100644 --- a/save-xml.c +++ b/save-xml.c @@ -509,10 +509,10 @@ void save_dives_buffer(struct membuffer *b, const bool select_only) /* save the dive sites */ put_format(b, "<divesites>\n"); for (i = 0; i < dive_site_table.nr; i++) { + int j; + struct dive *d; struct dive_site *ds = get_dive_site(i); if (dive_site_is_empty(ds)) { - int j; - struct dive *d; for_each_dive(j, d) { if (d->dive_site_uuid == ds->uuid) d->dive_site_uuid = 0; @@ -521,6 +521,17 @@ void save_dives_buffer(struct membuffer *b, const bool select_only) i--; // since we just deleted that one continue; } + if (select_only) { + bool found = false; + for_each_dive(j, d) { + if (d->selected && d->dive_site_uuid == ds->uuid) { + found = true; + break; + } + } + if (!found) + continue; + } put_format(b, "<site uuid='%8x'", ds->uuid); show_utf8(b, ds->name, " name='", "'", 1); if (ds->latitude.udeg || ds->longitude.udeg) { |