mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Don't clear known spells when reading from the savegame
This is needed because the .ess format doesn't include the racial spells in the player's spell list.
This commit is contained in:
parent
c7d15e6f74
commit
69676906ae
@ -23,6 +23,10 @@ namespace ESSImport
|
||||
mKnownDialogueTopics.push_back(esm.getHString());
|
||||
}
|
||||
|
||||
if (esm.isNextSub("MNAM"))
|
||||
esm.skipHSub(); // If this field is here it seems to specify the interior cell the player is in,
|
||||
// but it's not always here, so it's kinda useless
|
||||
|
||||
esm.getHNT(mPNAM, "PNAM");
|
||||
|
||||
if (esm.isNextSub("SNAM"))
|
||||
|
@ -312,21 +312,17 @@ namespace MWMechanics
|
||||
|
||||
void Spells::readState(const ESM::SpellState &state)
|
||||
{
|
||||
mSpells = state.mSpells;
|
||||
mSelectedSpell = state.mSelectedSpell;
|
||||
|
||||
// Discard spells that are no longer available due to changed content files
|
||||
for (TContainer::iterator iter = mSpells.begin(); iter!=mSpells.end();)
|
||||
for (TContainer::const_iterator it = state.mSpells.begin(); it != state.mSpells.end(); ++it)
|
||||
{
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(iter->first);
|
||||
if (!spell)
|
||||
// Discard spells that are no longer available due to changed content files
|
||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(it->first);
|
||||
if (spell)
|
||||
{
|
||||
if (iter->first == mSelectedSpell)
|
||||
mSelectedSpell = "";
|
||||
mSpells.erase(iter++);
|
||||
mSpells[it->first] = it->second;
|
||||
|
||||
if (it->first == state.mSelectedSpell)
|
||||
mSelectedSpell = it->first;
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
||||
// No need to discard spells here (doesn't really matter if non existent ids are kept)
|
||||
|
@ -12,6 +12,7 @@ namespace ESM
|
||||
class ESMReader;
|
||||
class ESMWriter;
|
||||
|
||||
// NOTE: spell ids must be lower case
|
||||
struct SpellState
|
||||
{
|
||||
struct CorprusStats
|
||||
|
Loading…
x
Reference in New Issue
Block a user