mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fixed battle replay
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "StdInc.h"
|
||||
#include "BattleQueries.h"
|
||||
#include "MapQueries.h"
|
||||
#include "QueriesProcessor.h"
|
||||
|
||||
#include "../CGameHandler.h"
|
||||
#include "../battles/BattleProcessor.h"
|
||||
@@ -18,6 +19,8 @@
|
||||
|
||||
void CBattleQuery::notifyObjectAboutRemoval(const CObjectVisitQuery & objectVisit) const
|
||||
{
|
||||
assert(result);
|
||||
|
||||
if(result)
|
||||
objectVisit.visitedObject->battleFinished(objectVisit.visitingHero, *result);
|
||||
}
|
||||
@@ -47,10 +50,21 @@ bool CBattleQuery::blocksPack(const CPack * pack) const
|
||||
|
||||
void CBattleQuery::onRemoval(PlayerColor color)
|
||||
{
|
||||
assert(result);
|
||||
|
||||
if(result)
|
||||
gh->battles->battleAfterLevelUp(battleID, *result);
|
||||
}
|
||||
|
||||
void CBattleQuery::onExposure(QueryPtr topQuery)
|
||||
{
|
||||
// this method may be called in two cases:
|
||||
// 1) when requesting battle replay (but before replay starts -> no valid result)
|
||||
// 2) when aswering on levelup queries after accepting battle result -> valid result
|
||||
if(result)
|
||||
owner->popQuery(*this);
|
||||
}
|
||||
|
||||
CBattleDialogQuery::CBattleDialogQuery(CGameHandler * owner, const IBattleInfo * bi):
|
||||
CDialogQuery(owner),
|
||||
bi(bi)
|
||||
@@ -64,7 +78,8 @@ void CBattleDialogQuery::onRemoval(PlayerColor color)
|
||||
assert(answer);
|
||||
if(*answer == 1)
|
||||
{
|
||||
gh->startBattlePrimary(
|
||||
gh->battles->restartBattlePrimary(
|
||||
bi->getBattleID(),
|
||||
bi->getSideArmy(0),
|
||||
bi->getSideArmy(1),
|
||||
bi->getLocation(),
|
||||
|
||||
Reference in New Issue
Block a user