1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

get rid of IBonusBearer::getSpellBonuses & Selector::anyRange

This commit is contained in:
AlexVinS
2016-10-01 09:07:18 +03:00
parent c243ae6f3e
commit 96c17505ae
6 changed files with 26 additions and 63 deletions

View File

@ -973,7 +973,15 @@ std::vector<si32> CStack::activeSpells() const
{
std::vector<si32> ret;
TBonusListPtr spellEffects = getSpellBonuses();
std::stringstream cachingStr;
cachingStr << "!type_" << Bonus::NONE << "source_" << Bonus::SPELL_EFFECT;
CSelector selector = Selector::sourceType(Bonus::SPELL_EFFECT)
.And(CSelector([](const Bonus *b)->bool
{
return b->type != Bonus::NONE;
}));
TBonusListPtr spellEffects = getBonuses(selector, Selector::all, cachingStr.str());
for(const std::shared_ptr<Bonus> it : *spellEffects)
{
if (!vstd::contains(ret, it->sid)) //do not duplicate spells with multiple effects