Loading/saving for player's original skills/attributes (prior to becoming a werewolf)

c++11
scrawl 10 years ago
parent 44582fe3b3
commit d6a7255391

@ -271,6 +271,11 @@ namespace MWWorld
player.mAutoMove = mAutoMove ? 1 : 0; player.mAutoMove = mAutoMove ? 1 : 0;
for (int i=0; i<ESM::Attribute::Length; ++i)
mSaveAttributes[i].writeState(player.mSaveAttributes[i]);
for (int i=0; i<ESM::Skill::Length; ++i)
mSaveSkills[i].writeState(player.mSaveSkills[i]);
writer.startRecord (ESM::REC_PLAY); writer.startRecord (ESM::REC_PLAY);
player.save (writer); player.save (writer);
writer.endRecord (ESM::REC_PLAY); writer.endRecord (ESM::REC_PLAY);
@ -291,6 +296,11 @@ namespace MWWorld
mPlayer.load (player.mObject); mPlayer.load (player.mObject);
for (int i=0; i<ESM::Attribute::Length; ++i)
mSaveAttributes[i].readState(player.mSaveAttributes[i]);
for (int i=0; i<ESM::Skill::Length; ++i)
mSaveSkills[i].readState(player.mSaveSkills[i]);
getPlayer().getClass().getCreatureStats(getPlayer()).getAiSequence().clear(); getPlayer().getClass().getCreatureStats(getPlayer()).getAiSequence().clear();
MWBase::World& world = *MWBase::Environment::get().getWorld(); MWBase::World& world = *MWBase::Environment::get().getWorld();

@ -31,6 +31,14 @@ void ESM::Player::load (ESMReader &esm)
esm.getHNOT (mCurrentCrimeId, "CURD"); esm.getHNOT (mCurrentCrimeId, "CURD");
mPaidCrimeId = -1; mPaidCrimeId = -1;
esm.getHNOT (mPaidCrimeId, "PAYD"); esm.getHNOT (mPaidCrimeId, "PAYD");
if (esm.hasMoreSubs())
{
for (int i=0; i<ESM::Attribute::Length; ++i)
mSaveAttributes[i].load(esm);
for (int i=0; i<ESM::Skill::Length; ++i)
mSaveSkills[i].load(esm);
}
} }
void ESM::Player::save (ESMWriter &esm) const void ESM::Player::save (ESMWriter &esm) const
@ -54,4 +62,9 @@ void ESM::Player::save (ESMWriter &esm) const
esm.writeHNT ("CURD", mCurrentCrimeId); esm.writeHNT ("CURD", mCurrentCrimeId);
esm.writeHNT ("PAYD", mPaidCrimeId); esm.writeHNT ("PAYD", mPaidCrimeId);
for (int i=0; i<ESM::Attribute::Length; ++i)
mSaveAttributes[i].save(esm);
for (int i=0; i<ESM::Skill::Length; ++i)
mSaveSkills[i].save(esm);
} }

@ -7,6 +7,9 @@
#include "cellid.hpp" #include "cellid.hpp"
#include "defs.hpp" #include "defs.hpp"
#include "loadskil.hpp"
#include "attr.hpp"
namespace ESM namespace ESM
{ {
class ESMReader; class ESMReader;
@ -28,6 +31,9 @@ namespace ESM
int mCurrentCrimeId; int mCurrentCrimeId;
int mPaidCrimeId; int mPaidCrimeId;
StatState<int> mSaveAttributes[ESM::Attribute::Length];
StatState<int> mSaveSkills[ESM::Skill::Length];
void load (ESMReader &esm); void load (ESMReader &esm);
void save (ESMWriter &esm) const; void save (ESMWriter &esm) const;
}; };

Loading…
Cancel
Save