1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00
This commit is contained in:
AlexVinS
2017-06-14 04:53:26 +03:00
parent 648b122b10
commit 0af9aa382c
3 changed files with 19 additions and 17 deletions

View File

@@ -821,10 +821,10 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
CBattleInterface *b = battleInt;
if (b->givenCommand->get())
if(CBattleInterface::givenCommand.get())
{
logGlobal->errorStream() << "Command buffer must be clean! (we don't want to use old command)";
vstd::clear_pointer(b->givenCommand->data);
vstd::clear_pointer(CBattleInterface::givenCommand.data);
}
{
@@ -833,17 +833,17 @@ BattleAction CPlayerInterface::activeStack(const CStack * stack) //called when i
//Regeneration & mana drain go there
}
//wait till BattleInterface sets its command
boost::unique_lock<boost::mutex> lock(b->givenCommand->mx);
while(!b->givenCommand->data)
boost::unique_lock<boost::mutex> lock(CBattleInterface::givenCommand.mx);
while(!CBattleInterface::givenCommand.data)
{
b->givenCommand->cond.wait(lock);
CBattleInterface::givenCommand.cond.wait(lock);
if (!battleInt) //battle ended while we were waiting for movement (eg. because of spell)
throw boost::thread_interrupted(); //will shut the thread peacefully
}
//tidy up
BattleAction ret = *(b->givenCommand->data);
vstd::clear_pointer(b->givenCommand->data);
BattleAction ret = *(CBattleInterface::givenCommand.data);
vstd::clear_pointer(CBattleInterface::givenCommand.data);
if (ret.actionType == Battle::CANCEL)
{