1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Merge pull request #1615 from SoundSSGood/CArtifactsOfHero-refactoring

Optimization and cleanup CArtifactHolder
This commit is contained in:
Ivan Savenko
2023-03-05 17:28:36 +02:00
committed by GitHub
8 changed files with 61 additions and 68 deletions

View File

@@ -143,6 +143,7 @@ CPlayerInterface::CPlayerInterface(PlayerColor Player)
duringMovement = false;
ignoreEvents = false;
numOfMovedArts = 0;
}
CPlayerInterface::~CPlayerInterface()
@@ -2149,21 +2150,28 @@ void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const Artifact
{
EVENT_HANDLER_CALLED_BY_CLIENT;
adventureInt->infoBar->showSelection();
bool redraw = true;
// If a bulk transfer has arrived, then redrawing only the last art movement.
if(numOfMovedArts != 0)
{
numOfMovedArts--;
if(numOfMovedArts != 0)
redraw = false;
}
for(auto isa : GH.listInt)
{
auto artWin = dynamic_cast<CArtifactHolder*>(isa.get());
if (artWin)
artWin->artifactMoved(src, dst);
artWin->artifactMoved(src, dst, redraw);
}
if(!GH.objsToBlit.empty())
GH.objsToBlit.back()->redraw();
waitWhileDialog();
}
void CPlayerInterface::artifactPossibleAssembling(const ArtifactLocation & dst)
void CPlayerInterface::bulkArtMovementStart(size_t numOfArts)
{
askToAssembleArtifact(dst);
numOfMovedArts = numOfArts;
}
void CPlayerInterface::artifactAssembled(const ArtifactLocation &al)