diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 7ca5e1fd6..d3c038ca4 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -5606,25 +5606,26 @@ void CGameHandler::runBattle() const BattleInfo & curB = *gs->curB; - std::set 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; while(!battleResult.get() && (next = curB.getNextStack()) && next->willMove()) { + + std::set 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); + } + //check for bad morale => freeze int nextStackMorale = next->MoraleVal(); if( nextStackMorale < 0 &&