1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

refactoring

This commit is contained in:
SoundSSGood
2024-05-02 01:49:17 +03:00
parent 6a1a6b6864
commit 09bb9895ce
7 changed files with 221 additions and 225 deletions

View File

@@ -90,20 +90,29 @@ void CArtifactsOfHeroBase::init(
void CArtifactsOfHeroBase::clickPrassedArtPlace(CArtPlace & artPlace, const Point & cursorPosition)
{
if(artPlace.isLocked())
return;
if(clickPressedCallback)
clickPressedCallback(*this, artPlace, cursorPosition);
clickPressedCallback(artPlace, cursorPosition);
}
void CArtifactsOfHeroBase::showPopupArtPlace(CArtPlace & artPlace, const Point & cursorPosition)
{
if(artPlace.isLocked())
return;
if(showPopupCallback)
showPopupCallback(*this, artPlace, cursorPosition);
showPopupCallback(artPlace, cursorPosition);
}
void CArtifactsOfHeroBase::gestureArtPlace(CArtPlace & artPlace, const Point & cursorPosition)
{
if(artPlace.isLocked())
return;
if(gestureCallback)
gestureCallback(*this, artPlace, cursorPosition);
gestureCallback(artPlace, cursorPosition);
}
void CArtifactsOfHeroBase::setHero(const CGHeroInstance * hero)
@@ -226,6 +235,11 @@ void CArtifactsOfHeroBase::addGestureCallback(CArtPlace::ClickFunctor callback)
}
}
const CArtifactInstance * CArtifactsOfHeroBase::getArt(const ArtifactPosition & slot)
{
return curHero ? curHero->getArt(slot) : nullptr;
}
void CArtifactsOfHeroBase::setSlotData(ArtPlacePtr artPlace, const ArtifactPosition & slot)
{
// Spurious call from artifactMoved in attempt to update hidden backpack slot