mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Fixed #731.
This commit is contained in:
@@ -894,7 +894,7 @@ void CPlayerInterface::battleAttack(const BattleAttack *ba)
|
|||||||
|
|
||||||
void CPlayerInterface::yourTacticPhase(int distance)
|
void CPlayerInterface::yourTacticPhase(int distance)
|
||||||
{
|
{
|
||||||
while(battleInt->tacticsMode)
|
while(battleInt && battleInt->tacticsMode)
|
||||||
boost::this_thread::sleep(boost::posix_time::millisec(1));
|
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]))
|
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
|
try
|
||||||
{
|
{
|
||||||
battleInt->yourTacticPhase(gs->curB->tacticDistance);
|
battleInt->yourTacticPhase(gs->curB->tacticDistance);
|
||||||
MakeAction ma(BattleAction::makeEndOFTacticPhase(battleInt->playerID));
|
if(gs && !!gs->curB && gs->curB->tacticDistance) //while awaiting for end of tactics phase, many things can happen (end of battle... or game)
|
||||||
serv->sendPack(ma);
|
{
|
||||||
|
MakeAction ma(BattleAction::makeEndOFTacticPhase(battleInt->playerID));
|
||||||
|
serv->sendPack(ma);
|
||||||
|
}
|
||||||
} HANDLE_EXCEPTION
|
} HANDLE_EXCEPTION
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4915,7 +4915,7 @@ void CGameHandler::runBattle()
|
|||||||
|
|
||||||
//tactic round
|
//tactic round
|
||||||
{
|
{
|
||||||
while(gs->curB->tacticDistance)
|
while(gs->curB->tacticDistance && !battleResult.get())
|
||||||
boost::this_thread::sleep(boost::posix_time::milliseconds(50));
|
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)
|
void CGameHandler::setBattleResult(int resultType, int victoriusSide)
|
||||||
{
|
{
|
||||||
|
if(battleResult.get())
|
||||||
|
{
|
||||||
|
complain("There is already set result?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
BattleResult *br = new BattleResult;
|
BattleResult *br = new BattleResult;
|
||||||
br->result = resultType;
|
br->result = resultType;
|
||||||
br->winner = victoriusSide; //surrendering side loses
|
br->winner = victoriusSide; //surrendering side loses
|
||||||
|
|||||||
@@ -236,7 +236,8 @@ bool MakeAction::applyGh( CGameHandler *gh )
|
|||||||
|
|
||||||
if(b->tacticDistance)
|
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;
|
ERROR_AND_RETURN;
|
||||||
if(gh->connections[b->sides[b->tacticsSide]] != c)
|
if(gh->connections[b->sides[b->tacticsSide]] != c)
|
||||||
ERROR_AND_RETURN;
|
ERROR_AND_RETURN;
|
||||||
|
|||||||
Reference in New Issue
Block a user