mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +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:
		| @@ -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; | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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()) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user