1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Remove pointers from artifacts

This commit is contained in:
Ivan Savenko
2025-03-30 23:09:43 +03:00
parent 4ed13409c2
commit d34b47bb20
29 changed files with 211 additions and 146 deletions

View File

@@ -168,7 +168,11 @@ public:
void load(std::vector<T> &data)
{
uint32_t length = readAndCheckLength();
data.resize(length);
if constexpr (std::is_base_of_v<GameCallbackHolder, T>)
data.resize(length, T(cb));
else
data.resize(length);
for(uint32_t i=0;i<length;i++)
load( data[i]);
}
@@ -373,7 +377,14 @@ public:
for(uint32_t i=0;i<length;i++)
{
load(key);
load(data[key]);
if constexpr (std::is_base_of_v<GameCallbackHolder, T2>)
{
data.try_emplace(key, cb);
load(data.at(key));
}
else
load(data[key]);
}
}
void load(std::string &data)