mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Correctly update drag-and-drop cursor if our window gets deactivated
This commit is contained in:
parent
526a6e4fe7
commit
57dba9433c
@ -67,6 +67,8 @@ void CCursorHandler::initCursor()
|
||||
|
||||
void CCursorHandler::changeGraphic(ECursor::ECursorTypes type, int index)
|
||||
{
|
||||
assert(dndObject == nullptr);
|
||||
|
||||
if(type != this->type)
|
||||
{
|
||||
this->type = type;
|
||||
|
@ -254,6 +254,22 @@ void CHeroArtPlace::clickRight(tribool down, bool previousState)
|
||||
}
|
||||
}
|
||||
|
||||
void CArtifactsOfHero::activate()
|
||||
{
|
||||
if (commonInfo->src.AOH == this && commonInfo->src.art)
|
||||
CCS->curh->dragAndDropCursor(make_unique<CAnimImage>("artifact", commonInfo->src.art->artType->getIconIndex()));
|
||||
|
||||
CIntObject::activate();
|
||||
}
|
||||
|
||||
void CArtifactsOfHero::deactivate()
|
||||
{
|
||||
if (commonInfo->src.AOH == this && commonInfo->src.art)
|
||||
CCS->curh->dragAndDropCursor(nullptr);
|
||||
|
||||
CIntObject::deactivate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Selects artifact slot so that the containing artifact looks like it's picked up.
|
||||
*/
|
||||
|
@ -148,6 +148,9 @@ public:
|
||||
void dispose(); //free resources not needed after closing windows and reset state
|
||||
void scrollBackpack(int dir); //dir==-1 => to left; dir==1 => to right
|
||||
|
||||
void activate() override;
|
||||
void deactivate() override;
|
||||
|
||||
void safeRedraw();
|
||||
void markPossibleSlots(const CArtifactInstance* art);
|
||||
void unmarkSlots(bool withRedraw = true); //unmarks slots in all visible AOHs
|
||||
|
Loading…
Reference in New Issue
Block a user