1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-04 22:14:25 +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()); addArtifactToTransfer(packCommander, artSlot.first, artSlot.second.getArt());
sendArtifacts(packCommander); sendArtifacts(packCommander);
} }
} auto armyObj = battle.battleGetArmyObject(battle.otherSide(battleResult->winner));
auto armyObj = battle.battleGetArmyObject(battle.otherSide(battleResult->winner)); for(const auto & armySlot : armyObj->stacks)
for(const auto & armySlot : armyObj->stacks) {
{ BulkMoveArtifacts packsArmy(finishingBattle->winnerHero->getOwner(), finishingBattle->loserHero->id, finishingBattle->winnerHero->id, false);
BulkMoveArtifacts packsArmy(finishingBattle->winnerHero->getOwner(), finishingBattle->loserHero->id, finishingBattle->winnerHero->id, false); packsArmy.srcArtHolder = armyObj->id;
packsArmy.srcArtHolder = armyObj->id; packsArmy.srcCreature = armySlot.first;
packsArmy.srcCreature = armySlot.first; for(const auto & artSlot : armySlot.second->artifactsWorn)
for(const auto & artSlot : armySlot.second->artifactsWorn) addArtifactToTransfer(packsArmy, artSlot.first, armySlot.second->getArt(artSlot.first));
addArtifactToTransfer(packsArmy, artSlot.first, armySlot.second->getArt(artSlot.first)); sendArtifacts(packsArmy);
sendArtifacts(packsArmy); }
} }
// Display loot // Display loot
if(!arts.empty()) if(!arts.empty())