mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
* fixed 592
This commit is contained in:
@@ -521,8 +521,10 @@ void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
askInterfaceForMove:
|
int numberOfAsks = 1;
|
||||||
//ask interface and wait for answer
|
bool breakOuter = false;
|
||||||
|
do
|
||||||
|
{//ask interface and wait for answer
|
||||||
if(!battleResult.get())
|
if(!battleResult.get())
|
||||||
{
|
{
|
||||||
BattleSetActiveStack sas;
|
BattleSetActiveStack sas;
|
||||||
@@ -533,8 +535,10 @@ askInterfaceForMove:
|
|||||||
battleMadeAction.cond.wait(lock);
|
battleMadeAction.cond.wait(lock);
|
||||||
battleMadeAction.data = false;
|
battleMadeAction.data = false;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if(battleResult.get()) //don't touch it, battle could be finished while waiting got action
|
||||||
{
|
{
|
||||||
|
breakOuter = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,8 +554,19 @@ askInterfaceForMove:
|
|||||||
&& nextStackMorale > 0
|
&& nextStackMorale > 0
|
||||||
&& !(NBonus::hasOfType(hero1, Bonus::BLOCK_MORALE) || NBonus::hasOfType(hero2, Bonus::BLOCK_MORALE)) //checking if heroes have (or don't have) morale blocking bonuses
|
&& !(NBonus::hasOfType(hero1, Bonus::BLOCK_MORALE) || NBonus::hasOfType(hero2, Bonus::BLOCK_MORALE)) //checking if heroes have (or don't have) morale blocking bonuses
|
||||||
)
|
)
|
||||||
|
{
|
||||||
if(rand()%24 < nextStackMorale) //this stack hasn't got morale this turn
|
if(rand()%24 < nextStackMorale) //this stack hasn't got morale this turn
|
||||||
goto askInterfaceForMove; //move this stack once more
|
++numberOfAsks; //move this stack once more
|
||||||
|
}
|
||||||
|
|
||||||
|
--numberOfAsks;
|
||||||
|
} while (numberOfAsks > 0);
|
||||||
|
|
||||||
|
if (breakOuter)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4245,7 +4260,9 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
|
|||||||
checkForBattleEnd(gs->curB->stacks);
|
checkForBattleEnd(gs->curB->stacks);
|
||||||
if(battleResult.get())
|
if(battleResult.get())
|
||||||
{
|
{
|
||||||
endBattle(gs->curB->tile, gs->curB->heroes[0], gs->curB->heroes[1]);
|
battleMadeAction.setn(true);
|
||||||
|
//battle will be ended by startBattle function
|
||||||
|
//endBattle(gs->curB->tile, gs->curB->heroes[0], gs->curB->heroes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user