Explorar el Código

regression fixed. Artifact assemble dialog shows multiple times.

SoundSSGood hace 3 años
padre
commit
0032947735

+ 5 - 1
client/CPlayerInterface.cpp

@@ -2591,7 +2591,11 @@ void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const Artifact
 		if (artWin)
 			artWin->artifactMoved(src, dst);
 	}
-	GH.listInt.back()->redraw();
+	GH.objsToBlit.back()->redraw();
+}
+
+void CPlayerInterface::artifactPossibleAssembling(const ArtifactLocation & dst)
+{
 	askToAssembleArtifact(dst);
 }
 

+ 1 - 0
client/CPlayerInterface.h

@@ -133,6 +133,7 @@ public:
 	void artifactRemoved(const ArtifactLocation &al) override;
 	void artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst) override;
 	void artifactAssembled(const ArtifactLocation &al) override;
+	void artifactPossibleAssembling(const ArtifactLocation & dst) override;
 	void artifactDisassembled(const ArtifactLocation &al) override;
 
 	void heroVisit(const CGHeroInstance * visitor, const CGObjectInstance * visitedObj, bool start) override;

+ 10 - 2
client/NetPacksClient.cpp

@@ -275,8 +275,12 @@ void EraseArtifact::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())
+	{
 		callInterfaceIfPresent(cl, dst.owningPlayer(), &IGameEventsReceiver::artifactMoved, src, dst);
+		callInterfaceIfPresent(cl, dst.owningPlayer(), &IGameEventsReceiver::artifactPossibleAssembling, dst);
+	}
 }
 
 void BulkMoveArtifacts::applyCl(CClient * cl)
@@ -286,7 +290,9 @@ void BulkMoveArtifacts::applyCl(CClient * cl)
 	{
 		auto srcLoc = ArtifactLocation(movingArts.srcArtHolder, slotToMove.srcPos);
 		auto dstLoc = ArtifactLocation(movingArts.dstArtHolder, slotToMove.dstPos);
-		MoveArtifact(&srcLoc, &dstLoc).applyCl(cl);
+		callInterfaceIfPresent(cl, srcLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
+		if (srcLoc.owningPlayer() != dstLoc.owningPlayer())
+			callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
 	}
 
 	if (artsPack1.has_value())
@@ -296,7 +302,9 @@ void BulkMoveArtifacts::applyCl(CClient * cl)
 		{
 			auto srcLoc = ArtifactLocation(movingArts.srcArtHolder, slotToMove.srcPos);
 			auto dstLoc = ArtifactLocation(movingArts.dstArtHolder, slotToMove.dstPos);
-			MoveArtifact(&srcLoc, &dstLoc).applyCl(cl);
+			callInterfaceIfPresent(cl, srcLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
+			if (srcLoc.owningPlayer() != dstLoc.owningPlayer())
+				callInterfaceIfPresent(cl, dstLoc.owningPlayer(), &IGameEventsReceiver::artifactMoved, srcLoc, dstLoc);
 		}
 	}
 }

+ 1 - 0
lib/IGameEventsReceiver.h

@@ -91,6 +91,7 @@ public:
 	virtual void artifactAssembled(const ArtifactLocation &al){};
 	virtual void artifactDisassembled(const ArtifactLocation &al){};
 	virtual void artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst){};
+	virtual void artifactPossibleAssembling(const ArtifactLocation & dst) {};
 
 	virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start){};
 	virtual void heroCreated(const CGHeroInstance*){};

+ 0 - 1
server/CGameHandler.h

@@ -180,7 +180,6 @@ public:
 	void giveHeroArtifact(const CGHeroInstance *h, const CArtifactInstance *a, ArtifactPosition pos) override;
 	void putArtifact(const ArtifactLocation &al, const CArtifactInstance *a) override;
 	void removeArtifact(const ArtifactLocation &al) override;
-	bool moveArtifact(const ArtifactLocation &al1, const ArtifactLocation &al2) override;
 	bool moveArtifact(const ArtifactLocation & al1, const ArtifactLocation & al2) override;
 	bool bulkMoveArtifacts(ObjectInstanceID srcHero, ObjectInstanceID dstHero);
 	bool bulkSwapArtifacts(ObjectInstanceID leftHero, ObjectInstanceID rightHero);