1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 01:49:41 +00:00

When clearing LocalPlayer's spells, keep race and birthsign abilities

This commit is contained in:
David Cernat 2017-01-20 08:06:48 +02:00
parent e7675d94d4
commit 0f7748d9d2

View file

@ -639,6 +639,7 @@ void LocalPlayer::addSpells()
for (vector<ESM::Spell>::const_iterator spell = packetSpells.spells.begin(); spell != packetSpells.spells.end(); spell++)
ptrSpells.add(spell->mId);
}
void LocalPlayer::removeItems()
@ -875,8 +876,16 @@ void LocalPlayer::setSpellbook()
MWWorld::Ptr ptrPlayer = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::Spells &ptrSpells = ptrPlayer.getClass().getCreatureStats(ptrPlayer).getSpells();
// Clear spells in spellbook
ptrSpells.clear();
// Clear spells in spellbook, while ignoring abilities, powers, etc.
for (MWMechanics::Spells::TIterator iter = ptrSpells.begin(); iter != ptrSpells.end(); ++iter)
{
const ESM::Spell *spell = iter->first;
if (spell->mData.mType == ESM::Spell::ST_Spell)
{
ptrSpells.remove(spell->mId);
}
}
// Proceed by adding spells
addSpells();