mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 20:09:40 +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
3 changed files with 13 additions and 12 deletions
|
@ -23,6 +23,10 @@ namespace ESSImport
|
||||||
mKnownDialogueTopics.push_back(esm.getHString());
|
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");
|
esm.getHNT(mPNAM, "PNAM");
|
||||||
|
|
||||||
if (esm.isNextSub("SNAM"))
|
if (esm.isNextSub("SNAM"))
|
||||||
|
|
|
@ -312,21 +312,17 @@ namespace MWMechanics
|
||||||
|
|
||||||
void Spells::readState(const ESM::SpellState &state)
|
void Spells::readState(const ESM::SpellState &state)
|
||||||
{
|
{
|
||||||
mSpells = state.mSpells;
|
for (TContainer::const_iterator it = state.mSpells.begin(); it != state.mSpells.end(); ++it)
|
||||||
mSelectedSpell = state.mSelectedSpell;
|
{
|
||||||
|
|
||||||
// Discard spells that are no longer available due to changed content files
|
// Discard spells that are no longer available due to changed content files
|
||||||
for (TContainer::iterator iter = mSpells.begin(); iter!=mSpells.end();)
|
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(it->first);
|
||||||
|
if (spell)
|
||||||
{
|
{
|
||||||
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(iter->first);
|
mSpells[it->first] = it->second;
|
||||||
if (!spell)
|
|
||||||
{
|
if (it->first == state.mSelectedSpell)
|
||||||
if (iter->first == mSelectedSpell)
|
mSelectedSpell = it->first;
|
||||||
mSelectedSpell = "";
|
|
||||||
mSpells.erase(iter++);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
++iter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to discard spells here (doesn't really matter if non existent ids are kept)
|
// 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 ESMReader;
|
||||||
class ESMWriter;
|
class ESMWriter;
|
||||||
|
|
||||||
|
// NOTE: spell ids must be lower case
|
||||||
struct SpellState
|
struct SpellState
|
||||||
{
|
{
|
||||||
struct CorprusStats
|
struct CorprusStats
|
||||||
|
|
Loading…
Reference in a new issue