mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #1758 from Adriankhl/fix_active_stack_spell_cast
Deactivate activeStack during spellCast
This commit is contained in:
@@ -310,6 +310,12 @@ void BattleInterface::spellCast(const BattleSpellCast * sc)
|
|||||||
{
|
{
|
||||||
windowObject->blockUI(true);
|
windowObject->blockUI(true);
|
||||||
|
|
||||||
|
// Disable current active stack duing the cast
|
||||||
|
// Store the current activeStack to stackToActivate
|
||||||
|
stacksController->deactivateStack();
|
||||||
|
|
||||||
|
CCS->curh->set(Cursor::Combat::BLOCKED);
|
||||||
|
|
||||||
const SpellID spellID = sc->spellID;
|
const SpellID spellID = sc->spellID;
|
||||||
const CSpell * spell = spellID.toSpell();
|
const CSpell * spell = spellID.toSpell();
|
||||||
auto targetedTile = sc->tile;
|
auto targetedTile = sc->tile;
|
||||||
@@ -551,6 +557,9 @@ void BattleInterface::endAction(const BattleAction* action)
|
|||||||
{
|
{
|
||||||
const CStack *stack = curInt->cb->battleGetStackByID(action->stackNumber);
|
const CStack *stack = curInt->cb->battleGetStackByID(action->stackNumber);
|
||||||
|
|
||||||
|
// Activate stack from stackToActivate because this might have been temporary disabled, e.g., during spell cast
|
||||||
|
activateStack();
|
||||||
|
|
||||||
stacksController->endAction(action);
|
stacksController->endAction(action);
|
||||||
windowObject->updateQueue();
|
windowObject->updateQueue();
|
||||||
|
|
||||||
|
@@ -683,6 +683,15 @@ void BattleStacksController::stackActivated(const CStack *stack)
|
|||||||
owner.activateStack();
|
owner.activateStack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleStacksController::deactivateStack()
|
||||||
|
{
|
||||||
|
if (!activeStack) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stackToActivate = activeStack;
|
||||||
|
setActiveStack(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void BattleStacksController::activateStack()
|
void BattleStacksController::activateStack()
|
||||||
{
|
{
|
||||||
if ( !currentAnimations.empty())
|
if ( !currentAnimations.empty())
|
||||||
|
@@ -118,7 +118,9 @@ public:
|
|||||||
void startAction(const BattleAction* action);
|
void startAction(const BattleAction* action);
|
||||||
void endAction(const BattleAction* action);
|
void endAction(const BattleAction* action);
|
||||||
|
|
||||||
void activateStack(); //sets activeStack to stackToActivate etc. //FIXME: No, it's not clear at all
|
void deactivateStack(); //copy activeStack to stackToActivate, then set activeStack to nullptr to temporary disable current stack
|
||||||
|
|
||||||
|
void activateStack(); //copy stackToActivate to activeStack to enable controls of the stack
|
||||||
|
|
||||||
void setActiveStack(const CStack *stack);
|
void setActiveStack(const CStack *stack);
|
||||||
void setSelectedStack(const CStack *stack);
|
void setSelectedStack(const CStack *stack);
|
||||||
|
Reference in New Issue
Block a user