1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

CStack refactoring

* removed all occurrences of attackerOwned
* Use BattleSide enum
* more tweaks
This commit is contained in:
AlexVinS
2017-07-01 11:34:00 +03:00
parent 29e50cc21c
commit 4f8c7bd4bb
31 changed files with 304 additions and 273 deletions

View File

@ -384,7 +384,7 @@ CBattleResultWindow::CBattleResultWindow(const BattleResult &br, const SDL_Rect
{
auto stacks = owner.cb->battleGetAllStacks();
vstd::erase_if(stacks, [i](const CStack *stack) //erase stack of other side and not coming from garrison
{ return stack->attackerOwned == i || !stack->base; });
{ return stack->side != i || !stack->base; });
auto best = vstd::maxElementByFun(stacks, [](const CStack *stack){ return stack->type->AIValue; });
if(best != stacks.end()) //should be always but to be safe...
@ -548,7 +548,7 @@ Point CClickableHex::getXYUnitAnim(BattleHex hexNum, const CStack * stack, CBatt
//shifting position for double - hex creatures
if(stack->doubleWide())
{
if(stack->attackerOwned)
if(stack->side == BattleSide::ATTACKER)
{
if(cbi->creDir[stack->ID])
ret.x -= 44;