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

fix test, throwing exception fix

This commit is contained in:
SoundSSGood
2023-11-09 12:38:50 +02:00
parent 57e3abc548
commit e1a9763ae4
2 changed files with 4 additions and 12 deletions

View File

@@ -2720,16 +2720,9 @@ bool CGameHandler::moveArtifact(const ArtifactLocation & src, const ArtifactLoca
ma.swap = true;
}
try
{
auto hero = getHero(dst.artHolder);
if(ArtifactUtils::checkSpellbookIsNeeded(hero, srcArtifact->artType->getId(), dstSlot))
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
}
catch(const std::bad_variant_access &)
{
// object other than hero received an art - ignore
}
auto hero = getHero(dst.artHolder);
if(ArtifactUtils::checkSpellbookIsNeeded(hero, srcArtifact->artType->getId(), dstSlot))
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
ma.artsPack0.push_back(BulkMoveArtifacts::LinkedSlots(src.slot, dstSlot));
if(src.artHolder != dst.artHolder)