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

Fixes for previous commit.

This commit is contained in:
DjWarmonger 2010-08-30 19:46:38 +00:00
parent bfe266a377
commit 30cf8b7e77
3 changed files with 16 additions and 4 deletions

View File

@ -4262,7 +4262,6 @@ void BattleInfo::getBonuses(BonusList &out, const CSelector &selector, const CBo
if (!dest)
return;
//TODO: make it in clean way
if(Selector::matchesType(selector, Bonus::MORALE) || Selector::matchesType(selector, Bonus::LUCK))
{

View File

@ -278,7 +278,7 @@ public:
{
Bonus hb(makeFeature(type, Bonus::N_TURNS, subtype, value, Bonus::SPELL_EFFECT, turnsRemain, additionalInfo));
hb.effectRange = limit;
hb.source = Bonus::SPELL; //right?
hb.source = Bonus::CASTED_SPELL; //right?
return hb;
}
@ -286,7 +286,7 @@ public:
{
Bonus ret(makeFeature(type, Bonus::N_TURNS, subtype, value, Bonus::SPELL_EFFECT, turnsRemain));
ret.valType = valType;
ret.source = Bonus::SPELL; //right?
ret.source = Bonus::CASTED_SPELL; //right?
return ret;
}

View File

@ -100,10 +100,23 @@ void DLL_EXPORT BonusList::getBonuses(BonusList &out, const CSelector &selector,
}
void DLL_EXPORT BonusList::removeSpells(Bonus::BonusSource sourceType)
{
limit_start:
for(iterator i = begin(); i != end(); i++)
{
if (i->source == sourceType)
erase(i);
{
iterator toErase = i;
if(i != begin())
{
i--;
erase(toErase);
}
else
{
erase(toErase);
goto limit_start;
}
}
}
}