1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-27 18:41:37 +00:00

Prevent spell duplication

This commit is contained in:
Evil Eye 2021-08-31 19:59:55 +02:00
parent b8e4f18751
commit 43074347e8

View file

@ -141,7 +141,7 @@ namespace MWMechanics
const ESM::Spell *spell = *iter; const ESM::Spell *spell = *iter;
if (filter(spell)) if (filter(spell))
{ {
mSpells.erase(iter++); iter = mSpells.erase(iter);
purged.push_back(spell->mId); purged.push_back(spell->mId);
} }
else else
@ -204,7 +204,7 @@ namespace MWMechanics
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(id); const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(id);
if (spell) if (spell)
{ {
mSpells.emplace_back(spell); addSpell(spell);
if (id == state.mSelectedSpell) if (id == state.mSelectedSpell)
mSelectedSpell = id; mSelectedSpell = id;