1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-27 21:49:10 +02:00

fix autoremoving UNTIL_ATTACK & UNITL_BEING_ATTACKED bonuses

* this should fix crashes with paralyze, stonegaze & blind
This commit is contained in:
AlexVinS 2015-04-13 09:28:00 +03:00
parent a2901cb8f0
commit 45a3ad94ae

@ -1278,13 +1278,13 @@ DLL_LINKAGE void BattleAttack::applyGs( CGameState *gs )
for(BattleStackAttacked stackAttacked : bsa) for(BattleStackAttacked stackAttacked : bsa)
stackAttacked.applyGs(gs); stackAttacked.applyGs(gs);
attacker->getBonusList().remove_if(Bonus::UntilAttack); attacker->popBonuses(Bonus::UntilAttack);
for(auto & elem : bsa) for(auto & elem : bsa)
{ {
CStack * stack = gs->curB->getStack(elem.stackAttacked, false); CStack * stack = gs->curB->getStack(elem.stackAttacked, false);
if (stack) //cloned stack is already gone if (stack) //cloned stack is already gone
stack->getBonusList().remove_if(Bonus::UntilBeingAttacked); stack->popBonuses(Bonus::UntilBeingAttacked);
} }
} }
@ -1456,15 +1456,6 @@ DLL_LINKAGE void StacksHealedOrResurrected::applyGs( CGameState *gs )
//removal of negative effects //removal of negative effects
if(resurrected) if(resurrected)
{ {
// for (BonusList::iterator it = changedStack->bonuses.begin(); it != changedStack->bonuses.end(); it++)
// {
// if(VLC->spellh->spells[(*it)->sid]->positiveness < 0)
// {
// changedStack->bonuses.erase(it);
// }
// }
//removing all features from negative spells //removing all features from negative spells
const BonusList tmpFeatures = changedStack->getBonusList(); const BonusList tmpFeatures = changedStack->getBonusList();
//changedStack->bonuses.clear(); //changedStack->bonuses.clear();