1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Removed pointer to VLC entity from CStackBasicDescriptor

This commit is contained in:
Ivan Savenko
2024-10-12 16:02:35 +00:00
parent c98ac01e7a
commit d3af9f1c67
38 changed files with 140 additions and 160 deletions

View File

@@ -485,13 +485,13 @@ VCMI_LIB_NAMESPACE_BEGIN
else
logMod->warn("Failed to select suitable random creature!");
stack.type = pickedCreature.toCreature();
stack.setType(pickedCreature.toCreature());
stack.count = loadValue(value, rng, variables);
if (!value["upgradeChance"].isNull() && !stack.type->upgrades.empty())
if (!value["upgradeChance"].isNull() && !stack.getCreature()->upgrades.empty())
{
if (int(value["upgradeChance"].Float()) > rng.nextInt(99)) // select random upgrade
{
stack.type = RandomGeneratorUtil::nextItem(stack.type->upgrades, rng)->toCreature();
stack.setType(RandomGeneratorUtil::nextItem(stack.getCreature()->upgrades, rng)->toCreature());
}
}
return stack;