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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user