فهرست منبع

vcmiartifacts fixed

SoundSSGood 2 سال پیش
والد
کامیت
e58be8e7f7
4فایلهای تغییر یافته به همراه11 افزوده شده و 2 حذف شده
  1. 0 1
      client/CPlayerInterface.cpp
  2. 2 0
      client/NetPacksClient.cpp
  3. 8 0
      lib/NetPacks.h
  4. 1 1
      server/CGameHandler.cpp

+ 0 - 1
client/CPlayerInterface.cpp

@@ -1912,7 +1912,6 @@ void CPlayerInterface::artifactPut(const ArtifactLocation &al)
 	EVENT_HANDLER_CALLED_BY_CLIENT;
 	auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder);
 	updateInfo(hero);
-	askToAssembleArtifact(al);
 }
 
 void CPlayerInterface::artifactRemoved(const ArtifactLocation &al)

+ 2 - 0
client/NetPacksClient.cpp

@@ -255,6 +255,8 @@ void ApplyClientNetPackVisitor::visitBulkSmartRebalanceStacks(BulkSmartRebalance
 void ApplyClientNetPackVisitor::visitPutArtifact(PutArtifact & pack)
 {
 	callInterfaceIfPresent(cl, pack.al.owningPlayer(), &IGameEventsReceiver::artifactPut, pack.al);
+	if(pack.askAssemble)
+		callInterfaceIfPresent(cl, pack.al.owningPlayer(), &IGameEventsReceiver::askToAssembleArtifact, pack.al);
 }
 
 void ApplyClientNetPackVisitor::visitEraseArtifact(EraseArtifact & pack)

+ 8 - 0
lib/NetPacks.h

@@ -950,7 +950,14 @@ struct DLL_LINKAGE CArtifactOperationPack : CPackForClient
 
 struct DLL_LINKAGE PutArtifact : CArtifactOperationPack
 {
+	PutArtifact() = default;
+	PutArtifact(ArtifactLocation * dst, bool askAssemble = true)
+		: al(*dst), askAssemble(askAssemble)
+	{
+	}
+
 	ArtifactLocation al;
+	bool askAssemble = false;
 	ConstTransitivePtr<CArtifactInstance> art;
 
 	void applyGs(CGameState * gs);
@@ -959,6 +966,7 @@ struct DLL_LINKAGE PutArtifact : CArtifactOperationPack
 	template <typename Handler> void serialize(Handler & h, const int version)
 	{
 		h & al;
+		h & askAssemble;
 		h & art;
 	}
 };

+ 1 - 1
server/CGameHandler.cpp

@@ -4074,7 +4074,7 @@ bool CGameHandler::eraseArtifactByClient(const ArtifactLocation & al)
 		COMPLAIN_RET("Cannot remove artifact!");
 
 	if(al.getArt()->artType->canBePutAt(hero) || al.slot != ArtifactPosition::TRANSITION_POS)
-		COMPLAIN_RET("Unlegal removing artifact");
+		COMPLAIN_RET("Illegal artifact removal request");
 
 	removeArtifact(al);
 	return true;