mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Possible fix for https://bugs.vcmi.eu/view.php?id=2692
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user