mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +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:
parent
46e3d849af
commit
a39e61373c
@ -647,6 +647,8 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
|
|||||||
autofightingAI->battleStart(army1, army2, int3(0,0,0), hero1, hero2, side);
|
autofightingAI->battleStart(army1, army2, int3(0,0,0), hero1, hero2, side);
|
||||||
isAutoFightOn = true;
|
isAutoFightOn = true;
|
||||||
cb->registerBattleInterface(autofightingAI);
|
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
|
//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;
|
isAutoFightOn = false;
|
||||||
cb->unregisterBattleInterface(autofightingAI);
|
cb->unregisterBattleInterface(autofightingAI);
|
||||||
autofightingAI.reset();
|
autofightingAI.reset();
|
||||||
|
adventureInt->quickCombatUnlock();
|
||||||
|
|
||||||
if(!battleInt)
|
if(!battleInt)
|
||||||
{
|
{
|
||||||
|
@ -1707,6 +1707,18 @@ void CAdvMapInt::adjustActiveness(bool aiTurnStart)
|
|||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAdvMapInt::quickCombatLock()
|
||||||
|
{
|
||||||
|
if(!duringAITurn)
|
||||||
|
deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAdvMapInt::quickCombatUnlock()
|
||||||
|
{
|
||||||
|
if(!duringAITurn)
|
||||||
|
activate();
|
||||||
|
}
|
||||||
|
|
||||||
void CAdvMapInt::changeMode(EAdvMapMode newMode, float newScale /* = 0.4f */)
|
void CAdvMapInt::changeMode(EAdvMapMode newMode, float newScale /* = 0.4f */)
|
||||||
{
|
{
|
||||||
if (mode != newMode)
|
if (mode != newMode)
|
||||||
|
@ -224,6 +224,8 @@ public:
|
|||||||
void aiTurnStarted();
|
void aiTurnStarted();
|
||||||
|
|
||||||
void adjustActiveness(bool aiTurnStart); //should be called every time at AI/human turn transition; blocks GUI during AI turn
|
void adjustActiveness(bool aiTurnStart); //should be called every time at AI/human turn transition; blocks GUI during AI turn
|
||||||
|
void quickCombatLock(); //should be called when quick battle started
|
||||||
|
void quickCombatUnlock();
|
||||||
void tileLClicked(const int3 &mapPos);
|
void tileLClicked(const int3 &mapPos);
|
||||||
void tileHovered(const int3 &mapPos);
|
void tileHovered(const int3 &mapPos);
|
||||||
void tileRClicked(const int3 &mapPos);
|
void tileRClicked(const int3 &mapPos);
|
||||||
|
Loading…
Reference in New Issue
Block a user