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

Merge pull request #4421 from SoundSSGood/endBattleConfirm-fix

endBattleConfirm crash fix
This commit is contained in:
Ivan Savenko 2024-08-09 15:22:58 +03:00 committed by GitHub
commit 1b6fd45aa7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -447,16 +447,16 @@ void BattleResultProcessor::endBattleConfirm(const CBattleInfoCallback & battle)
addArtifactToTransfer(packCommander, artSlot.first, artSlot.second.getArt());
sendArtifacts(packCommander);
}
}
auto armyObj = battle.battleGetArmyObject(battle.otherSide(battleResult->winner));
for(const auto & armySlot : armyObj->stacks)
{
BulkMoveArtifacts packsArmy(finishingBattle->winnerHero->getOwner(), finishingBattle->loserHero->id, finishingBattle->winnerHero->id, false);
packsArmy.srcArtHolder = armyObj->id;
packsArmy.srcCreature = armySlot.first;
for(const auto & artSlot : armySlot.second->artifactsWorn)
addArtifactToTransfer(packsArmy, artSlot.first, armySlot.second->getArt(artSlot.first));
sendArtifacts(packsArmy);
auto armyObj = battle.battleGetArmyObject(battle.otherSide(battleResult->winner));
for(const auto & armySlot : armyObj->stacks)
{
BulkMoveArtifacts packsArmy(finishingBattle->winnerHero->getOwner(), finishingBattle->loserHero->id, finishingBattle->winnerHero->id, false);
packsArmy.srcArtHolder = armyObj->id;
packsArmy.srcCreature = armySlot.first;
for(const auto & artSlot : armySlot.second->artifactsWorn)
addArtifactToTransfer(packsArmy, artSlot.first, armySlot.second->getArt(artSlot.first));
sendArtifacts(packsArmy);
}
}
// Display loot
if(!arts.empty())