1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Development

This commit is contained in:
nordsoft
2022-11-03 23:48:55 +04:00
parent 219a282916
commit 48925a50f2
5 changed files with 17 additions and 3 deletions

View File

@@ -206,6 +206,7 @@ BattleInfo * BattleInfo::setupBattle(const int3 & tile, TerrainId terrain, const
curB->battlefieldType = battlefieldType;
curB->round = -2;
curB->activeStack = -1;
curB->creatureBank = creatureBank;
if(town)
{

View File

@@ -34,6 +34,7 @@ public:
si32 round, activeStack;
const CGTownInstance * town; //used during town siege, nullptr if this is not a siege (note that fortless town IS also a siege)
int3 tile; //for background and bonuses
bool creatureBank; //auxilary field, do not serialize
std::vector<CStack*> stacks;
std::vector<std::shared_ptr<CObstacleInstance> > obstacles;
SiegeInfo si;

View File

@@ -819,7 +819,7 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con
}
}
auto battleDialogQuery = std::make_shared<CDialogQuery>(this);
auto battleDialogQuery = std::make_shared<CBattleDialogQuery>(this, battleQuery->bi);
battleResult.data->queryID = battleDialogQuery->queryID;
queries.addQuery(battleDialogQuery);
sendAndApply(battleResult.data); //after this point casualties objects are destroyed

View File

@@ -380,13 +380,21 @@ bool CGarrisonDialogQuery::blocksPack(const CPack * pack) const
return CDialogQuery::blocksPack(pack);
}
CBattleDialogQuery::CBattleDialogQuery(CGameHandler * owner, const BattleInfo * Bi):
CDialogQuery(owner)
{
bi = Bi;
for(auto & side : bi->sides)
addPlayer(side.color);
}
void CBattleDialogQuery::onRemoval(PlayerColor color)
{
assert(answer);
if(*answer == 1)
{
int a = 0;
++a;
gh->startBattlePrimary(bi->sides[0].armyObject, bi->sides[1].armyObject, bi->tile, bi->sides[0].hero, bi->sides[1].hero, bi->creatureBank, bi->town);
}
}

View File

@@ -147,6 +147,10 @@ public:
class CBattleDialogQuery : public CDialogQuery
{
public:
CBattleDialogQuery(CGameHandler * owner, const BattleInfo * Bi);
const BattleInfo * bi;
virtual void onRemoval(PlayerColor color) override;
};