1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

regression fixed. Artifact assemble dialog shows multiple times.

This commit is contained in:
SoundSSGood 2022-11-07 00:36:13 +02:00
parent a35db9a696
commit 0032947735
5 changed files with 17 additions and 4 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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*){};

View File

@ -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);