1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

Minor improvements.

This commit is contained in:
Michał W. Urbańczyk 2013-06-24 14:35:27 +00:00
parent dd808ef5cc
commit 1a2c8de6ad
2 changed files with 7 additions and 3 deletions

View File

@ -621,6 +621,9 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
waitForAllDialogs(); waitForAllDialogs();
if(isAutoFightOn)
GH.topInt()->deactivate();
BATTLE_EVENT_POSSIBLE_RETURN; BATTLE_EVENT_POSSIBLE_RETURN;
GH.pushInt(battleInt); GH.pushInt(battleInt);
@ -758,7 +761,6 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
{ {
if(isAutoFightOn) if(isAutoFightOn)
{ {
assert(autofightingAI);
auto ret = autofightingAI->activeStack(stack); auto ret = autofightingAI->activeStack(stack);
if(isAutoFightOn) if(isAutoFightOn)
{ {

View File

@ -3588,7 +3588,7 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
{ {
assert(curInt->isAutoFightOn); assert(curInt->isAutoFightOn);
auto tmp = make_unique<boost::thread>([&] boost::thread aiThread([&]
{ {
auto ba = new BattleAction(curInt->autofightingAI->activeStack(activeStack)); auto ba = new BattleAction(curInt->autofightingAI->activeStack(activeStack));
@ -3598,11 +3598,13 @@ void CBattleInterface::requestAutofightingAIToTakeAction()
} }
else else
{ {
delete ba;
boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim); boost::unique_lock<boost::recursive_mutex> un(*LOCPLINT->pim);
activateStack(); activateStack();
} }
}); });
tmp->detach();
aiThread.detach();
} }
CBattleInterface::SiegeHelper::SiegeHelper(const CGTownInstance *siegeTown, const CBattleInterface * _owner) CBattleInterface::SiegeHelper::SiegeHelper(const CGTownInstance *siegeTown, const CBattleInterface * _owner)