don't allow more than 4 potion effects

This commit is contained in:
scrawl 2012-05-25 16:23:49 +02:00
parent 1df1b521a4
commit 63b3b82657

View file

@ -281,9 +281,10 @@ namespace MWGui
++it; ++it;
} }
// now remove duplicates // now remove duplicates, and don't allow more than 4 effects
Widgets::SpellEffectList old = effects; Widgets::SpellEffectList old = effects;
effects.clear(); effects.clear();
int i=0;
for (Widgets::SpellEffectList::iterator it = old.begin(); for (Widgets::SpellEffectList::iterator it = old.begin();
it != old.end(); ++it) it != old.end(); ++it)
{ {
@ -294,8 +295,11 @@ namespace MWGui
if (*it2 == *it) if (*it2 == *it)
found = true; found = true;
} }
if (!found) if (!found && i<4)
{
++i;
effects.push_back(*it); effects.push_back(*it);
}
} }
mEffects = effects; mEffects = effects;