core: fix undo of dive merging

When merging two dives, if a divesite is chosen that doesn't
have a GPS location, but another divesite has a GPS location,
then the GPS location of the former is set to that of the
latter.

However, that was done outside of the undo system, so that
it is not undone and the frontend is not made aware of the
change.

Fix this. To simplify things, move the code from the undo
machinery to the core.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-09-01 14:12:05 +02:00 committed by Michael Keller
parent 27a89b0232
commit cc55c442a3
6 changed files with 81 additions and 44 deletions

View file

@ -198,7 +198,7 @@ void dive::clear()
* any impact on the source */
void copy_dive(const struct dive *s, struct dive *d)
{
/* simply copy things over, but then the dive cache. */
/* simply copy things over, but then clear the dive cache. */
*d = *s;
d->invalidate_cache();
}