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

Remove serialization of raw pointers from serialization

This commit is contained in:
Ivan Savenko
2025-03-30 22:07:17 +03:00
parent 8ec3e5210a
commit 4ed13409c2
14 changed files with 39 additions and 30 deletions

View File

@@ -276,11 +276,7 @@ CGTownInstance::CGTownInstance(IGameCallback *cb):
this->setNodeType(CBonusSystemNode::TOWN);
}
CGTownInstance::~CGTownInstance()
{
for (auto & elem : rewardableBuildings)
delete elem.second;
}
CGTownInstance::~CGTownInstance() = default;
int CGTownInstance::spellsAtLevel(int level, bool checkGuild) const
{
@@ -398,7 +394,7 @@ void CGTownInstance::initializeConfigurableBuildings(vstd::RNG & rand)
continue;
try {
rewardableBuildings[kvp.first] = new TownRewardableBuildingInstance(this, kvp.second->bid, rand);
rewardableBuildings[kvp.first] = std::make_unique<TownRewardableBuildingInstance>(this, kvp.second->bid, rand);
}
catch (std::runtime_error & e)
{