1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

CGameHandler::moveArtifact: check lock status by slot instead of id

This one fix issue 2455. We still need to do something with ArtifactID::ART_LOCK or ids for artifact from mods since they might conflict with each other.
This commit is contained in:
Arseniy Shestakov 2016-08-18 06:35:29 +03:00
parent 91c298bdaa
commit 39fe9472b6
3 changed files with 6 additions and 3 deletions

View File

@ -1086,8 +1086,8 @@ void VCAI::pickBestArtifacts(const CGHeroInstance * h, const CGHeroInstance * ot
if (compareArtifacts(artifact, otherSlot->artifact) && artifact->canBePutAt(destLocation, true)) //combined artifacts are not always allowed to move
{
cb->swapArtifacts(location, ArtifactLocation(target, target->getArtPos(otherSlot->artifact)));
break;
changeMade = true;
break;
}
}
}

View File

@ -942,7 +942,7 @@ public:
//CORNUCOPIA = 140,
//FIXME: the following is only true if WoG is enabled. Otherwise other mod artifacts will take these slots.
ART_SELECTION = 144,
ART_LOCK = 145,
ART_LOCK = 145, // FIXME: We must get rid of this one since it's conflict with artifact from mods. See issue 2455
AXE_OF_SMASHING = 146,
MITHRIL_MAIL = 147,
SWORD_OF_SHARPNESS = 148,

View File

@ -3193,7 +3193,10 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat
&& srcArtifact && !srcArtifact->canBePutAt(dst, true))
COMPLAIN_RET("Cannot move artifact!");
if ((srcArtifact && srcArtifact->artType->id == ArtifactID::ART_LOCK) || (destArtifact && destArtifact->artType->id == ArtifactID::ART_LOCK))
auto srcSlot = src.getSlot();
auto dstSlot = dst.getSlot();
if ((srcSlot && srcSlot->locked) || (dstSlot && dstSlot->locked))
COMPLAIN_RET("Cannot move artifact locks.");
if (dst.slot >= GameConstants::BACKPACK_START && srcArtifact->artType->isBig())