mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Development
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user