mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Fix battle timer reset after refactoring
This commit is contained in:
parent
dd3e9f102b
commit
fb21620c60
@ -88,12 +88,21 @@ void TurnTimerHandler::onPlayerMakingTurn(PlayerState & state, int waitTime)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurnTimerHandler::onBattleStart(PlayerState & state)
|
void TurnTimerHandler::onBattleStart()
|
||||||
{
|
{
|
||||||
if(const auto * si = gameHandler.getStartInfo())
|
const auto * gs = gameHandler.gameState();
|
||||||
|
const auto * si = gameHandler.getStartInfo();
|
||||||
|
if(!si || !gs || !gs->curB || !si->turnTimerInfo.isBattleEnabled())
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto attacker = gs->curB->getSidePlayer(BattleSide::ATTACKER);
|
||||||
|
auto defender = gs->curB->getSidePlayer(BattleSide::DEFENDER);
|
||||||
|
|
||||||
|
for(auto i : {attacker, defender})
|
||||||
{
|
{
|
||||||
if(si->turnTimerInfo.isBattleEnabled())
|
if(i.isValidPlayer())
|
||||||
{
|
{
|
||||||
|
const auto & state = gs->players.at(i);
|
||||||
TurnTimeUpdate ttu;
|
TurnTimeUpdate ttu;
|
||||||
ttu.player = state.color;
|
ttu.player = state.color;
|
||||||
ttu.turnTimer = state.turnTimer;
|
ttu.turnTimer = state.turnTimer;
|
||||||
|
@ -33,7 +33,7 @@ public:
|
|||||||
void onGameplayStart(PlayerState & state);
|
void onGameplayStart(PlayerState & state);
|
||||||
void onPlayerGetTurn(PlayerState & state);
|
void onPlayerGetTurn(PlayerState & state);
|
||||||
void onPlayerMakingTurn(PlayerState & state, int waitTime);
|
void onPlayerMakingTurn(PlayerState & state, int waitTime);
|
||||||
void onBattleStart(PlayerState & state);
|
void onBattleStart();
|
||||||
void onBattleNextStack(const CStack & stack);
|
void onBattleNextStack(const CStack & stack);
|
||||||
void onBattleLoop(int waitTime);
|
void onBattleLoop(int waitTime);
|
||||||
};
|
};
|
||||||
|
@ -130,6 +130,8 @@ void BattleFlowProcessor::onBattleStarted()
|
|||||||
assert(gameHandler->gameState()->curB);
|
assert(gameHandler->gameState()->curB);
|
||||||
|
|
||||||
tryPlaceMoats();
|
tryPlaceMoats();
|
||||||
|
|
||||||
|
gameHandler->turnTimerHandler.onBattleStart();
|
||||||
|
|
||||||
if (gameHandler->gameState()->curB->tacticDistance == 0)
|
if (gameHandler->gameState()->curB->tacticDistance == 0)
|
||||||
onTacticsEnded();
|
onTacticsEnded();
|
||||||
|
Loading…
Reference in New Issue
Block a user