1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Fixed battle replay

This commit is contained in:
Ivan Savenko
2023-09-05 17:22:11 +03:00
parent 8bdddd1324
commit 1f1f978328
11 changed files with 110 additions and 34 deletions

View File

@ -2119,7 +2119,7 @@ void BattleStart::applyGs(CGameState * gs) const
info->battleID = gs->nextBattleID;
info->localInit();
vstd::next(gs->nextBattleID, 1);
gs->nextBattleID = vstd::next(gs->nextBattleID, 1);
}
void BattleNextRound::applyGs(CGameState * gs) const
@ -2177,6 +2177,17 @@ void BattleUpdateGateState::applyGs(CGameState * gs) const
gs->getBattle(battleID)->si.gateState = state;
}
void BattleCancelled::applyGs(CGameState * gs) const
{
auto currentBattle = boost::range::find_if(gs->currentBattles, [&](const auto & battle)
{
return battle->battleID == battleID;
});
assert(currentBattle != gs->currentBattles.end());
gs->currentBattles.erase(currentBattle);
}
void BattleResultAccepted::applyGs(CGameState * gs) const
{
// Remove any "until next battle" bonuses