1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

* Fixed bug 101, placing artifacts in specific slots in the backpack. Cleaned up swapArtifacts() to use more descriptive names as well.

This commit is contained in:
OnionKnight
2009-11-10 03:10:14 +00:00
parent db4ee5844f
commit 64a72c39cb
4 changed files with 57 additions and 36 deletions

View File

@ -3523,8 +3523,8 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
}
else //perform artifact substitution
{
if(slotID >= 19) //we are an backpack slot - remove active artifact and put it to the last free pos in backpack
{ //TODO: putting artifacts in the middle of backpack (pushing following arts)
if (slotID >= 19) // Backpack slot - Remove active artifact and insert it into the designated position in backpack.
{
const CArtifact *cur = ourOwner->commonInfo->activeArtPlace->ourArt;
assert(cur); //there is highlighted slot, it must contain an art
switch(cur->id)
@ -3544,21 +3544,21 @@ void CArtPlace::clickLeft(tribool down, bool previousState)
ourOwner->commonInfo->activeArtPlace->ourOwner->curHero,
ourOwner->commonInfo->activeArtPlace->slotID,
ourOwner->curHero,
ourOwner->curHero->artifacts.size() + 19);
slotID);
break;
}
}
//check if swap is possible
else if(this->fitsHere(ourOwner->commonInfo->activeArtPlace->ourArt) && ourOwner->commonInfo->activeArtPlace->fitsHere(this->ourArt))
{
int destSlot = slotID,
srcSlot = ourOwner->commonInfo->activeArtPlace->slotID;
int srcSlot = ourOwner->commonInfo->activeArtPlace->slotID;
int destSlot = slotID;
LOCPLINT->cb->swapArtifacts(
ourOwner->curHero,
destSlot,
ourOwner->commonInfo->activeArtPlace->ourOwner->curHero,
srcSlot);
srcSlot,
ourOwner->curHero,
destSlot);
ourOwner->commonInfo->activeArtPlace->clicked = false;
ourOwner->commonInfo->activeArtPlace = NULL;