mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Attempt to fix crash
This commit is contained in:
@ -88,21 +88,21 @@ void TurnTimerHandler::onPlayerGetTurn(PlayerColor player)
|
|||||||
void TurnTimerHandler::update(int waitTime)
|
void TurnTimerHandler::update(int waitTime)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> guard(mx);
|
std::lock_guard<std::recursive_mutex> guard(mx);
|
||||||
if(const auto * gs = gameHandler.gameState())
|
if(!gameHandler.getStartInfo()->turnTimerInfo.isEnabled())
|
||||||
{
|
return;
|
||||||
|
|
||||||
for(PlayerColor player(0); player < PlayerColor::PLAYER_LIMIT; ++player)
|
for(PlayerColor player(0); player < PlayerColor::PLAYER_LIMIT; ++player)
|
||||||
if(gs->isPlayerMakingTurn(player))
|
if(gameHandler.gameState()->isPlayerMakingTurn(player))
|
||||||
onPlayerMakingTurn(player, waitTime);
|
onPlayerMakingTurn(player, waitTime);
|
||||||
|
|
||||||
// create copy for iterations - battle might end during onBattleLoop call
|
// create copy for iterations - battle might end during onBattleLoop call
|
||||||
std::vector<BattleID> ongoingBattles;
|
std::vector<BattleID> ongoingBattles;
|
||||||
|
|
||||||
for (auto & battle : gs->currentBattles)
|
for (auto & battle : gameHandler.gameState()->currentBattles)
|
||||||
ongoingBattles.push_back(battle->battleID);
|
ongoingBattles.push_back(battle->battleID);
|
||||||
|
|
||||||
for (auto & battleID : ongoingBattles)
|
for (auto & battleID : ongoingBattles)
|
||||||
onBattleLoop(battleID, waitTime);
|
onBattleLoop(battleID, waitTime);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TurnTimerHandler::timerCountDown(int & timer, int initialTimer, PlayerColor player, int waitTime)
|
bool TurnTimerHandler::timerCountDown(int & timer, int initialTimer, PlayerColor player, int waitTime)
|
||||||
|
Reference in New Issue
Block a user