mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Stacks of armed instance are now unique_ptr
This commit is contained in:
@@ -454,7 +454,7 @@ void CGCreature::joinDecision(const CGHeroInstance *h, int cost, ui32 accept) co
|
||||
|
||||
giveReward(h);
|
||||
|
||||
for(std::pair<const SlotID, CStackInstance*> stack : this->stacks)
|
||||
for(auto & stack : this->stacks)
|
||||
stack.second->count = getJoiningAmount();
|
||||
|
||||
cb->tryJoiningArmy(this, h, true, true);
|
||||
@@ -672,10 +672,10 @@ void CGCreature::serializeJsonOptions(JsonSerializeFormat & handler)
|
||||
{
|
||||
si32 amount = 0;
|
||||
handler.serializeInt("amount", amount);
|
||||
auto * hlp = new CStackInstance();
|
||||
auto hlp = std::make_unique<CStackInstance>();
|
||||
hlp->count = amount;
|
||||
//type will be set during initialization
|
||||
putStack(SlotID(0), hlp);
|
||||
putStack(SlotID(0), std::move(hlp));
|
||||
}
|
||||
|
||||
resources.serializeJson(handler, "rewardResources");
|
||||
|
||||
Reference in New Issue
Block a user