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

Fix spellcast cancelation in battle

This commit is contained in:
Ivan Savenko 2023-05-30 19:16:50 +03:00
parent 0e36a3ab5a
commit 1cec6918a0
3 changed files with 4 additions and 8 deletions

View File

@ -971,6 +971,9 @@ void BattleActionsController::activateStack()
void BattleActionsController::onHexRightClicked(BattleHex clickedHex) void BattleActionsController::onHexRightClicked(BattleHex clickedHex)
{ {
if (spellcastingModeActive())
endCastingSpell();
auto selectedStack = owner.curInt->cb->battleGetStackByPos(clickedHex, true); auto selectedStack = owner.curInt->cb->battleGetStackByPos(clickedHex, true);
if (selectedStack != nullptr) if (selectedStack != nullptr)

View File

@ -85,7 +85,7 @@ BattleWindow::BattleWindow(BattleInterface & owner):
else else
tacticPhaseEnded(); tacticPhaseEnded();
addUsedEvents(RCLICK | KEYBOARD); addUsedEvents(KEYBOARD);
} }
void BattleWindow::createQueue() void BattleWindow::createQueue()
@ -203,12 +203,6 @@ void BattleWindow::keyPressed(EShortcut key)
InterfaceObjectConfigurable::keyPressed(key); InterfaceObjectConfigurable::keyPressed(key);
} }
void BattleWindow::clickRight(tribool down, bool previousState)
{
if (!down)
owner.actionsController->endCastingSpell();
}
void BattleWindow::tacticPhaseStarted() void BattleWindow::tacticPhaseStarted()
{ {
auto menuBattle = widget<CIntObject>("menuBattle"); auto menuBattle = widget<CIntObject>("menuBattle");

View File

@ -86,7 +86,6 @@ public:
void deactivate() override; void deactivate() override;
void keyPressed(EShortcut key) override; void keyPressed(EShortcut key) override;
bool captureThisKey(EShortcut key) override; bool captureThisKey(EShortcut key) override;
void clickRight(tribool down, bool previousState) override;
void show(Canvas & to) override; void show(Canvas & to) override;
void showAll(Canvas & to) override; void showAll(Canvas & to) override;