Skip to content

Commit

Permalink
Merge pull request #77 from Fayth/mantis-1993
Browse files Browse the repository at this point in the history
Good catch, thanks!
  • Loading branch information
DjWarmonger authored and DjWarmonger committed Jan 24, 2015
2 parents 60932d9 + 72f34a7 commit 6120b2e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions client/widgets/CGarrisonInt.cpp
Expand Up @@ -239,17 +239,20 @@ void CGarrisonSlot::clickLeft(tribool down, bool previousState)
{
const CGHeroInstance *srcHero = commonInfo->src.AOH->getHero();
artSelected = true;
ArtifactLocation src(srcHero, commonInfo->src.slotID);
ArtifactLocation dst(myStack, ArtifactPosition::CREATURE_SLOT);
if (art->canBePutAt(dst, true))
{ //equip clicked stack
if(dst.getArt())
{
//creature can wear only one active artifact
//if we are placing a new one, the old one will be returned to the hero's backpack
LOCPLINT->cb->swapArtifacts(dst, ArtifactLocation(srcHero, dst.getArt()->firstBackpackSlot(srcHero)));
if (myStack) // try dropping the artifact only if the slot isn't empty
{
ArtifactLocation src(srcHero, commonInfo->src.slotID);
ArtifactLocation dst(myStack, ArtifactPosition::CREATURE_SLOT);
if (art->canBePutAt(dst, true))
{ //equip clicked stack
if(dst.getArt())
{
//creature can wear only one active artifact
//if we are placing a new one, the old one will be returned to the hero's backpack
LOCPLINT->cb->swapArtifacts(dst, ArtifactLocation(srcHero, dst.getArt()->firstBackpackSlot(srcHero)));
}
LOCPLINT->cb->swapArtifacts(src, dst);
}
LOCPLINT->cb->swapArtifacts(src, dst);
}
}
}
Expand Down

0 comments on commit 6120b2e

Please sign in to comment.