From 0f7748d9d246cca378507316d9d0bc493d883a43 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 20 Jan 2017 08:06:48 +0200 Subject: [PATCH] When clearing LocalPlayer's spells, keep race and birthsign abilities --- apps/openmw/mwmp/LocalPlayer.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmp/LocalPlayer.cpp b/apps/openmw/mwmp/LocalPlayer.cpp index d117966c6..c81e3b8c6 100644 --- a/apps/openmw/mwmp/LocalPlayer.cpp +++ b/apps/openmw/mwmp/LocalPlayer.cpp @@ -639,6 +639,7 @@ void LocalPlayer::addSpells() for (vector::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();