1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +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) if (!dest)
return; return;
//TODO: make it in clean way //TODO: make it in clean way
if(Selector::matchesType(selector, Bonus::MORALE) || Selector::matchesType(selector, Bonus::LUCK)) 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)); Bonus hb(makeFeature(type, Bonus::N_TURNS, subtype, value, Bonus::SPELL_EFFECT, turnsRemain, additionalInfo));
hb.effectRange = limit; hb.effectRange = limit;
hb.source = Bonus::SPELL; //right? hb.source = Bonus::CASTED_SPELL; //right?
return hb; return hb;
} }
@ -286,7 +286,7 @@ public:
{ {
Bonus ret(makeFeature(type, Bonus::N_TURNS, subtype, value, Bonus::SPELL_EFFECT, turnsRemain)); Bonus ret(makeFeature(type, Bonus::N_TURNS, subtype, value, Bonus::SPELL_EFFECT, turnsRemain));
ret.valType = valType; ret.valType = valType;
ret.source = Bonus::SPELL; //right? ret.source = Bonus::CASTED_SPELL; //right?
return ret; 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) void DLL_EXPORT BonusList::removeSpells(Bonus::BonusSource sourceType)
{ {
limit_start:
for(iterator i = begin(); i != end(); i++) for(iterator i = begin(); i != end(); i++)
{ {
if (i->source == sourceType) if (i->source == sourceType)
erase(i); {
iterator toErase = i;
if(i != begin())
{
i--;
erase(toErase);
}
else
{
erase(toErase);
goto limit_start;
}
}
} }
} }