mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fixed #731.
This commit is contained in:
parent
4c3ed24fe1
commit
4f20c5a376
@ -894,7 +894,7 @@ void CPlayerInterface::battleAttack(const BattleAttack *ba)
|
||||
|
||||
void CPlayerInterface::yourTacticPhase(int distance)
|
||||
{
|
||||
while(battleInt->tacticsMode)
|
||||
while(battleInt && battleInt->tacticsMode)
|
||||
boost::this_thread::sleep(boost::posix_time::millisec(1));
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ void CClient::battleStarted(const BattleInfo * info)
|
||||
|
||||
if(info->tacticDistance && vstd::contains(battleints,info->sides[info->tacticsSide]))
|
||||
{
|
||||
boost::thread hlp = boost::thread(&CClient::commenceTacticPhaseForInt, this, battleints[info->sides[info->tacticsSide]]);
|
||||
boost::thread(&CClient::commenceTacticPhaseForInt, this, battleints[info->sides[info->tacticsSide]]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -636,8 +636,11 @@ void CClient::commenceTacticPhaseForInt(CBattleGameInterface *battleInt)
|
||||
try
|
||||
{
|
||||
battleInt->yourTacticPhase(gs->curB->tacticDistance);
|
||||
MakeAction ma(BattleAction::makeEndOFTacticPhase(battleInt->playerID));
|
||||
serv->sendPack(ma);
|
||||
if(gs && !!gs->curB && gs->curB->tacticDistance) //while awaiting for end of tactics phase, many things can happen (end of battle... or game)
|
||||
{
|
||||
MakeAction ma(BattleAction::makeEndOFTacticPhase(battleInt->playerID));
|
||||
serv->sendPack(ma);
|
||||
}
|
||||
} HANDLE_EXCEPTION
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user