mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Move ghost creation to inner battle loop
This commit is contained in:
parent
42af83f0dd
commit
e3e27b9bfe
@ -5606,25 +5606,26 @@ void CGameHandler::runBattle()
|
|||||||
|
|
||||||
const BattleInfo & curB = *gs->curB;
|
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
|
//stack loop
|
||||||
|
|
||||||
const CStack *next;
|
const CStack *next;
|
||||||
while(!battleResult.get() && (next = curB.getNextStack()) && next->willMove())
|
while(!battleResult.get() && (next = curB.getNextStack()) && next->willMove())
|
||||||
{
|
{
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
//check for bad morale => freeze
|
//check for bad morale => freeze
|
||||||
int nextStackMorale = next->MoraleVal();
|
int nextStackMorale = next->MoraleVal();
|
||||||
if( nextStackMorale < 0 &&
|
if( nextStackMorale < 0 &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user