1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-05 15:05:40 +02:00

Properly disable combat panel during spell targeting

This commit is contained in:
Ivan Savenko 2023-03-28 18:14:09 +03:00
parent 47e774897d
commit 238de8a5d7
2 changed files with 7 additions and 5 deletions

View File

@ -119,7 +119,10 @@ BattleActionsController::BattleActionsController(BattleInterface & owner):
void BattleActionsController::endCastingSpell()
{
if(heroSpellToCast)
{
heroSpellToCast.reset();
owner.windowObject->blockUI(false);
}
if(owner.stacksController->getActiveStack())
possibleActions = getPossibleActionsForStack(owner.stacksController->getActiveStack()); //restore actions after they were cleared
@ -287,6 +290,8 @@ void BattleActionsController::castThisSpell(SpellID spellID)
possibleActions.push_back (spellSelMode); //only this one action can be performed at the moment
GH.fakeMouseMove();//update cursor
}
owner.windowObject->blockUI(true);
}
const CSpell * BattleActionsController::getHeroSpellToCast( ) const

View File

@ -541,11 +541,8 @@ void BattleWindow::blockUI(bool on)
w->block(on || owner.tacticsMode);
if(auto w = widget<CButton>("alternativeAction"))
w->block(on || owner.tacticsMode);
// block only if during enemy turn and auto-fight is off
// otherwise - crash on accessing non-exisiting active stack
if(auto w = widget<CButton>("options"))
w->block(!owner.curInt->isAutoFightOn && !owner.stacksController->getActiveStack());
if(auto w = widget<CButton>("autofight"))
w->block(owner.actionsController->spellcastingModeActive());
auto btactEnd = widget<CButton>("tacticEnd");
auto btactNext = widget<CButton>("tacticNext");