mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix server shutdown on transferring artifact to commander
This commit is contained in:
@@ -3916,9 +3916,17 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat
|
|||||||
moveArtifact(dst, ArtifactLocation(dst.artHolder, ArtifactPosition(
|
moveArtifact(dst, ArtifactLocation(dst.artHolder, ArtifactPosition(
|
||||||
(si32)dst.getHolderArtSet()->artifactsInBackpack.size() + GameConstants::BACKPACK_START)));
|
(si32)dst.getHolderArtSet()->artifactsInBackpack.size() + GameConstants::BACKPACK_START)));
|
||||||
}
|
}
|
||||||
auto hero = boost::get<ConstTransitivePtr<CGHeroInstance>>(dst.artHolder);
|
|
||||||
if(ArtifactUtils::checkSpellbookIsNeeded(hero, srcArtifact->artType->id, dst.slot))
|
try
|
||||||
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
{
|
||||||
|
auto hero = boost::get<ConstTransitivePtr<CGHeroInstance>>(dst.artHolder);
|
||||||
|
if(ArtifactUtils::checkSpellbookIsNeeded(hero, srcArtifact->artType->id, dst.slot))
|
||||||
|
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
||||||
|
}
|
||||||
|
catch (boost::bad_get const &)
|
||||||
|
{
|
||||||
|
// object other than hero received an art - ignore
|
||||||
|
}
|
||||||
|
|
||||||
MoveArtifact ma(&src, &dst);
|
MoveArtifact ma(&src, &dst);
|
||||||
sendAndApply(&ma);
|
sendAndApply(&ma);
|
||||||
|
Reference in New Issue
Block a user