1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00
This commit is contained in:
Michał W. Urbańczyk
2011-08-25 21:08:53 +00:00
parent 4c3ed24fe1
commit 4f20c5a376
4 changed files with 15 additions and 6 deletions

View File

@@ -4915,7 +4915,7 @@ void CGameHandler::runBattle()
//tactic round
{
while(gs->curB->tacticDistance)
while(gs->curB->tacticDistance && !battleResult.get())
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
}
@@ -5191,6 +5191,11 @@ void CGameHandler::giveHeroNewArtifact(const CGHeroInstance *h, const CArtifact
void CGameHandler::setBattleResult(int resultType, int victoriusSide)
{
if(battleResult.get())
{
complain("There is already set result?");
return;
}
BattleResult *br = new BattleResult;
br->result = resultType;
br->winner = victoriusSide; //surrendering side loses

View File

@@ -236,7 +236,8 @@ bool MakeAction::applyGh( CGameHandler *gh )
if(b->tacticDistance)
{
if(ba.actionType != BattleAction::WALK && ba.actionType != BattleAction::END_TACTIC_PHASE)
if(ba.actionType != BattleAction::WALK && ba.actionType != BattleAction::END_TACTIC_PHASE
&& ba.actionType != BattleAction::RETREAT && ba.actionType != BattleAction::SURRENDER)
ERROR_AND_RETURN;
if(gh->connections[b->sides[b->tacticsSide]] != c)
ERROR_AND_RETURN;