1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Fixed crash after a battle when resurrection was cast.

[However the spell still is not implemented correctly... :/ ]
This commit is contained in:
Michał W. Urbańczyk 2011-05-25 20:44:18 +00:00
parent d4ed4cf9a0
commit 528f0363a1
2 changed files with 9 additions and 2 deletions

View File

@ -2305,8 +2305,6 @@ std::vector<si32> CStack::activeSpells() const
CStack::~CStack()
{
detachFromAll();
if(vstd::contains(state, SUMMONED))
delNull(base);
}
const CGHeroInstance * CStack::getMyHero() const

View File

@ -929,6 +929,15 @@ DLL_EXPORT void BattleSetActiveStack::applyGs( CGameState *gs )
void BattleResult::applyGs( CGameState *gs )
{
//stack with SUMMONED flag but coming from garrison -> most likely resurrected, needs to be removed
BOOST_FOREACH(CStack *s, gs->curB->stacks)
{
if(s->base && s->base->armyObj && vstd::contains(s->state, SUMMONED))
{
assert(&s->base->armyObj->getStack(s->slot) == s->base);
const_cast<CArmedInstance*>(s->base->armyObj)->eraseStack(s->slot);
}
}
for(unsigned i=0;i<gs->curB->stacks.size();i++)
delete gs->curB->stacks[i];