1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
This commit is contained in:
AlexVinS 2016-02-29 04:42:15 +03:00
parent 97504364e4
commit f890037008
3 changed files with 18 additions and 9 deletions

View File

@ -1018,9 +1018,9 @@ void CBattleInterface::stackRemoved(int stackID)
}
}
delete creAnims[stackID];
creAnims.erase(stackID);
creDir.erase(stackID);
// delete creAnims[stackID];
// creAnims.erase(stackID);
// creDir.erase(stackID);
redrawBackgroundWithHexes(activeStack);
queue->update();
}
@ -3408,8 +3408,13 @@ BattleObjectsByHex CBattleInterface::sortObjectsByHex()
BattleObjectsByHex sorted;
auto stacks = curInt->cb->battleGetStacksIf([](const CStack * s)
{
return !s->isTurret();
});
// Sort creatures
for (auto & stack : curInt->cb->battleGetAllStacks())
for (auto & stack : stacks)
{
if(creAnims.find(stack->ID) == creAnims.end()) //e.g. for summoned but not yet handled stacks
continue;

View File

@ -256,11 +256,15 @@ const CStack* CBattleInfoEssentials::battleGetStackByID(int ID, bool onlyAlive)
{
RETURN_IF_NOT_BATTLE(nullptr);
for(auto s : battleGetAllStacks(true))
if(s->ID == ID && (!onlyAlive || s->alive()))
return s;
auto stacks = battleGetStacksIf([=](const CStack * s)
{
return s->ID == ID && (!onlyAlive || s->alive());
});
return nullptr;
if(stacks.empty())
return nullptr;
else
return stacks[0];
}
bool CBattleInfoEssentials::battleDoWeKnowAbout(ui8 side) const

View File

@ -4400,7 +4400,7 @@ bool CGameHandler::makeCustomAction( BattleAction &ba )
s->battleCast(spellEnv, parameters);
sendAndApply(&end_action);
if( !gs->curB->battleGetStackByID(gs->curB->activeStack, true))
if( !gs->curB->battleGetStackByID(gs->curB->activeStack))
{
battleMadeAction.setn(true);
}