mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Bonus Source ID now uses metaidentifier
This commit is contained in:
@@ -121,23 +121,23 @@ BattleHex::EDir CStack::destShiftDir() const
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<si32> CStack::activeSpells() const
|
||||
std::vector<SpellID> CStack::activeSpells() const
|
||||
{
|
||||
std::vector<si32> ret;
|
||||
std::vector<SpellID> ret;
|
||||
|
||||
std::stringstream cachingStr;
|
||||
cachingStr << "!type_" << vstd::to_underlying(BonusType::NONE) << "source_" << vstd::to_underlying(BonusSource::SPELL_EFFECT);
|
||||
CSelector selector = Selector::sourceType()(BonusSource::SPELL_EFFECT)
|
||||
.And(CSelector([](const Bonus * b)->bool
|
||||
{
|
||||
return b->type != BonusType::NONE && SpellID(b->sid).toSpell() && !SpellID(b->sid).toSpell()->isAdventure();
|
||||
return b->type != BonusType::NONE && b->sid.as<SpellID>().toSpell() && !b->sid.as<SpellID>().toSpell()->isAdventure();
|
||||
}));
|
||||
|
||||
TConstBonusListPtr spellEffects = getBonuses(selector, Selector::all, cachingStr.str());
|
||||
for(const auto & it : *spellEffects)
|
||||
{
|
||||
if(!vstd::contains(ret, it->sid)) //do not duplicate spells with multiple effects
|
||||
ret.push_back(it->sid);
|
||||
if(!vstd::contains(ret, it->sid.as<SpellID>())) //do not duplicate spells with multiple effects
|
||||
ret.push_back(it->sid.as<SpellID>());
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user