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

Merge pull request #1094 from Nordsoft91/autobattle-bugfix

[965] Fix for auto-battle crash
This commit is contained in:
Andrii Danylchenko
2022-11-03 08:17:30 +02:00
committed by GitHub

View File

@@ -925,13 +925,13 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
void CPlayerInterface::battleEnd(const BattleResult *br) void CPlayerInterface::battleEnd(const BattleResult *br)
{ {
EVENT_HANDLER_CALLED_BY_CLIENT; EVENT_HANDLER_CALLED_BY_CLIENT;
if (isAutoFightOn) if(isAutoFightOn || autofightingAI)
{ {
isAutoFightOn = false; isAutoFightOn = false;
cb->unregisterBattleInterface(autofightingAI); cb->unregisterBattleInterface(autofightingAI);
autofightingAI.reset(); autofightingAI.reset();
if (!battleInt) if(!battleInt)
{ {
GH.pushIntT<CBattleResultWindow>(*br, *this); GH.pushIntT<CBattleResultWindow>(*br, *this);
// #1490 - during AI turn when quick combat is on, we need to display the message and wait for user to close it. // #1490 - during AI turn when quick combat is on, we need to display the message and wait for user to close it.