1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-21 00:19:29 +02:00

Stacks of armed instance are now unique_ptr

This commit is contained in:
Ivan Savenko
2025-03-17 21:11:06 +00:00
parent bdae7285ae
commit c02a8a84fd
33 changed files with 101 additions and 115 deletions

View File

@ -104,7 +104,7 @@ void DwellingInstanceConstructor::randomizeObject(CGDwelling * dwelling, vstd::R
JsonRandom::Variables emptyVariables;
for(auto & stack : randomizer.loadCreatures(guards, rng, emptyVariables))
{
dwelling->putStack(SlotID(dwelling->stacksCount()), new CStackInstance(stack.getId(), stack.count));
dwelling->putStack(SlotID(dwelling->stacksCount()), std::make_unique<CStackInstance>(stack.getId(), stack.count));
}
}
else if (dwelling->ID == Obj::CREATURE_GENERATOR1 || dwelling->ID == Obj::CREATURE_GENERATOR4)
@ -125,7 +125,7 @@ void DwellingInstanceConstructor::randomizeObject(CGDwelling * dwelling, vstd::R
for(auto creatureEntry : availableCreatures)
{
const CCreature * crea = creatureEntry.at(0);
dwelling->putStack(SlotID(dwelling->stacksCount()), new CStackInstance(crea->getId(), crea->getGrowth() * 3));
dwelling->putStack(SlotID(dwelling->stacksCount()), std::make_unique<CStackInstance>(crea->getId(), crea->getGrowth() * 3));
}
}
}