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

Removed pointer to army from StackInstance

This commit is contained in:
Ivan Savenko
2025-03-18 23:30:06 +00:00
parent 16a06179cf
commit 63d00b080e
80 changed files with 260 additions and 280 deletions

View File

@@ -48,14 +48,14 @@ void ArmyFormation::rearrangeArmyForSiege(const CGTownInstance * town, const CGH
if(town->fortLevel() > CGTownInstance::FORT)
{
std::vector<CStackInstance *> stacks;
std::vector<const CStackInstance *> stacks;
for(const auto & slot : attacker->Slots())
stacks.push_back(slot.second.get());
boost::sort(
stacks,
[](CStackInstance * slot1, CStackInstance * slot2) -> bool
[](const CStackInstance * slot1, const CStackInstance * slot2) -> bool
{
auto cre1 = slot1->getCreatureID().toCreature();
auto cre2 = slot2->getCreatureID().toCreature();
@@ -67,7 +67,7 @@ void ArmyFormation::rearrangeArmyForSiege(const CGTownInstance * town, const CGH
for(int i = 0; i < stacks.size(); i++)
{
auto pos = stacks[i]->armyObj->findStack(stacks[i]);
auto pos = stacks[i]->getArmy()->findStack(stacks[i]);
if(pos.getNum() != i)
cb->swapCreatures(attacker, attacker, static_cast<SlotID>(i), pos);