1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix callback propagation when copy-pasting objects

This commit is contained in:
Michał Zaremba
2025-06-04 00:05:18 +02:00
parent 4881729ec1
commit bf11b9b82a
2 changed files with 6 additions and 4 deletions

View File

@@ -31,10 +31,11 @@ public:
CMemorySerializer();
template <typename T>
static std::unique_ptr<T> deepCopy(const T &data)
static std::unique_ptr<T> deepCopy(const T &data, IGameInfoCallback * cb = nullptr)
{
CMemorySerializer mem;
mem.oser & &data;
mem.iser.cb = cb;
std::unique_ptr<T> ret;
mem.iser & ret;
@@ -42,10 +43,11 @@ public:
}
template <typename T>
static std::shared_ptr<T> deepCopyShared(const T &data)
static std::shared_ptr<T> deepCopyShared(const T &data, IGameInfoCallback * cb = nullptr)
{
CMemorySerializer mem;
mem.oser & &data;
mem.iser.cb = cb;
std::shared_ptr<T> ret;
mem.iser & ret;