mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Picture handling: don't add the same picture more than once
It confuses us elsewhere (the model suddenly doesn't match the list of pictures as the model doesn't reflect the duplicate pictures). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e7ecb690ed
commit
543f3ac584
1 changed files with 11 additions and 0 deletions
11
dive.c
11
dive.c
|
@ -2272,8 +2272,19 @@ struct picture *alloc_picture()
|
||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool new_picture_for_dive(struct dive *d, char *filename)
|
||||||
|
{
|
||||||
|
FOR_EACH_PICTURE(d) {
|
||||||
|
if (same_string(picture->filename, filename))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void dive_create_picture(struct dive *d, char *filename, int shift_time)
|
void dive_create_picture(struct dive *d, char *filename, int shift_time)
|
||||||
{
|
{
|
||||||
|
if (!new_picture_for_dive(d, filename))
|
||||||
|
return;
|
||||||
struct picture *p = alloc_picture();
|
struct picture *p = alloc_picture();
|
||||||
p->filename = filename;
|
p->filename = filename;
|
||||||
picture_load_exif_data(p);
|
picture_load_exif_data(p);
|
||||||
|
|
Loading…
Add table
Reference in a new issue