mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix server shutdown on transferring artifact to commander
This commit is contained in:
parent
6379c5f6fa
commit
e188060480
@ -3916,9 +3916,17 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat
|
||||
moveArtifact(dst, ArtifactLocation(dst.artHolder, ArtifactPosition(
|
||||
(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))
|
||||
giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK);
|
||||
|
||||
try
|
||||
{
|
||||
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);
|
||||
sendAndApply(&ma);
|
||||
|
Loading…
Reference in New Issue
Block a user