mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	end of battle art assembling fix
This commit is contained in:
		
				
					committed by
					
						 Ivan Savenko
						Ivan Savenko
					
				
			
			
				
	
			
			
			
						parent
						
							3e1e41ef59
						
					
				
				
					commit
					d5cef0c069
				
			| @@ -272,15 +272,18 @@ void EraseArtifact::applyCl(CClient *cl) | ||||
| 	callInterfaceIfPresent(cl, al.owningPlayer(), &IGameEventsReceiver::artifactRemoved, al); | ||||
| } | ||||
|  | ||||
| void MoveArtifact::applyCl(CClient *cl) | ||||
| void MoveArtifact::applyCl(CClient * cl) | ||||
| { | ||||
| 	callInterfaceIfPresent(cl, src.owningPlayer(), &IGameEventsReceiver::artifactMoved, src, dst); | ||||
| 	callInterfaceIfPresent(cl, src.owningPlayer(), &IGameEventsReceiver::artifactPossibleAssembling, dst); | ||||
| 	if(src.owningPlayer() != dst.owningPlayer()) | ||||
| 	auto moveArtifact = [this, cl](PlayerColor player) -> void | ||||
| 	{ | ||||
| 		callInterfaceIfPresent(cl, dst.owningPlayer(), &IGameEventsReceiver::artifactMoved, src, dst); | ||||
| 		callInterfaceIfPresent(cl, dst.owningPlayer(), &IGameEventsReceiver::artifactPossibleAssembling, dst); | ||||
| 	} | ||||
| 		callInterfaceIfPresent(cl, player, &IGameEventsReceiver::artifactMoved, src, dst); | ||||
| 		if(askAssemble) | ||||
| 			callInterfaceIfPresent(cl, player, &IGameEventsReceiver::artifactPossibleAssembling, dst); | ||||
| 	}; | ||||
|  | ||||
| 	moveArtifact(src.owningPlayer()); | ||||
| 	if(src.owningPlayer() != dst.owningPlayer()) | ||||
| 		moveArtifact(dst.owningPlayer()); | ||||
| } | ||||
|  | ||||
| void BulkMoveArtifacts::applyCl(CClient * cl) | ||||
|   | ||||
| @@ -994,10 +994,12 @@ struct EraseArtifact : CArtifactOperationPack | ||||
|  | ||||
| struct MoveArtifact : CArtifactOperationPack | ||||
| { | ||||
| 	MoveArtifact() {} | ||||
| 	MoveArtifact(ArtifactLocation * src, ArtifactLocation * dst)  | ||||
| 		: src(*src), dst(*dst) {} | ||||
| 	MoveArtifact()  | ||||
| 		: askAssemble(true) {} | ||||
| 	MoveArtifact(ArtifactLocation * src, ArtifactLocation * dst, bool askAssemble = true) | ||||
| 		: src(*src), dst(*dst), askAssemble(askAssemble){} | ||||
| 	ArtifactLocation src, dst; | ||||
| 	bool askAssemble; | ||||
|  | ||||
| 	void applyCl(CClient *cl); | ||||
| 	DLL_LINKAGE void applyGs(CGameState *gs); | ||||
| @@ -1006,6 +1008,7 @@ struct MoveArtifact : CArtifactOperationPack | ||||
| 	{ | ||||
| 		h & src; | ||||
| 		h & dst; | ||||
| 		h & askAssemble; | ||||
| 	} | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -756,7 +756,10 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con | ||||
| 		auto sendMoveArtifact = [&](const CArtifactInstance *art, MoveArtifact *ma) | ||||
| 		{ | ||||
| 			arts.push_back(art); | ||||
| 			ma->dst = ArtifactLocation(finishingBattle->winnerHero, art->firstAvailableSlot(finishingBattle->winnerHero)); | ||||
| 			auto slot = art->firstAvailableSlot(finishingBattle->winnerHero); | ||||
| 			ma->dst = ArtifactLocation(finishingBattle->winnerHero, slot); | ||||
| 			if(ArtifactUtils::isSlotBackpack(slot)) | ||||
| 				ma->askAssemble = false; | ||||
| 			sendAndApply(ma); | ||||
| 		}; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user