1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-13 01:20:34 +02:00

Do not remove battle stacks, make them ghosts instead.

* exclude ghost stacks from (hopefully all) get* results for now
This commit is contained in:
AlexVinS
2016-02-28 01:08:56 +03:00
parent 5d5ad99436
commit 9036d39241
6 changed files with 19 additions and 70 deletions

View File

@ -142,26 +142,6 @@ CStack * BattleInfo::generateNewStack(const CStackBasicDescriptor &base, bool at
return ret;
}
const CStack * BattleInfo::battleGetStack(BattleHex pos, bool onlyAlive)
{
CStack * stack = nullptr;
for(auto & elem : stacks)
{
if(elem->position == pos
|| (elem->doubleWide()
&&( (elem->attackerOwned && elem->position-1 == pos)
|| (!elem->attackerOwned && elem->position+1 == pos) )
) )
{
if (elem->alive())
return elem; //we prefer living stacks - there can be only one stack on the tile, so return it immediately
else if (!onlyAlive)
stack = elem; //dead stacks are only accessible when there's no alive stack on this tile
}
}
return stack;
}
const CGHeroInstance * BattleInfo::battleGetOwner(const CStack * stack) const
{
return sides[!stack->attackerOwned].hero;