1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Ensure that ghost stacks are created only by BattleStacksRemoved packet.

This will allow client to receive notification.
This commit is contained in:
AlexVinS
2016-03-01 05:24:35 +03:00
parent 5c716f6581
commit 4bf9036c7b
5 changed files with 22 additions and 4 deletions

View File

@@ -5606,6 +5606,20 @@ void CGameHandler::runBattle()
const BattleInfo & curB = *gs->curB;
std::set <const CStack *> stacksToRemove;
for(auto stack : curB.stacks)
{
if(vstd::contains(stack->state, EBattleStackState::GHOST_PENDING))
stacksToRemove.insert(stack);
}
for(auto stack : stacksToRemove)
{
BattleStacksRemoved bsr;
bsr.stackIDs.insert(stack->ID);
sendAndApply(&bsr);
}
//stack loop
const CStack *next;