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

Deactivate CAdvMapInt while quick combat is going. Fix issue 2354

If quick combat calculation take a while it's possible to give hero movement command before battle is finished. This will lead to client freeze or crash. To avoid this we must lock adventure interface until battle calculation is finished.
This commit is contained in:
Arseniy Shestakov
2016-01-10 18:00:24 +03:00
parent 46e3d849af
commit a39e61373c
3 changed files with 17 additions and 0 deletions

View File

@ -647,6 +647,8 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
autofightingAI->battleStart(army1, army2, int3(0,0,0), hero1, hero2, side);
isAutoFightOn = true;
cb->registerBattleInterface(autofightingAI);
// Player shouldn't be able to move on adventure map if quick combat is going
adventureInt->quickCombatLock();
}
//Don't wait for dialogs when we are non-active hot-seat player
@ -843,6 +845,7 @@ void CPlayerInterface::battleEnd(const BattleResult *br)
isAutoFightOn = false;
cb->unregisterBattleInterface(autofightingAI);
autofightingAI.reset();
adventureInt->quickCombatUnlock();
if(!battleInt)
{