1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Fix battle replaying

This commit is contained in:
Ivan Savenko 2023-08-23 22:46:42 +03:00
parent 26bddbac44
commit a84c5fa371
3 changed files with 8 additions and 0 deletions

View File

@ -67,6 +67,7 @@ void BattleProcessor::startBattlePrimary(const CArmedInstance *army1, const CArm
heroes[0] = hero1;
heroes[1] = hero2;
resultProcessor->setupBattle();
setupBattle(tile, armies, heroes, creatureBank, town); //initializes stacks, places creatures on battlefield, blocks and informs player interfaces
auto lastBattleQuery = std::dynamic_pointer_cast<CBattleQuery>(gameHandler->queries->topQuery(gameHandler->gameState()->curB->sides[0].color));

View File

@ -539,6 +539,12 @@ void BattleResultProcessor::setBattleResult(EBattleResult resultType, int victor
gameHandler->gameState()->curB->calculateCasualties(battleResult->casualties);
}
void BattleResultProcessor::setupBattle()
{
finishingBattle.reset();
battleResult.reset();
}
bool BattleResultProcessor::battleIsEnding() const
{
return battleResult != nullptr;

View File

@ -73,6 +73,7 @@ public:
bool battleIsEnding() const;
void setupBattle();
void setBattleResult(EBattleResult resultType, int victoriusSide);
void endBattle(int3 tile, const CGHeroInstance * hero1, const CGHeroInstance * hero2); //ends battle
void endBattleConfirm(const BattleInfo * battleInfo);