forked from mirror/openmw-tes3mp
Savegame: store actorIds
This commit is contained in:
parent
51020fdb5f
commit
61187c2fef
7 changed files with 37 additions and 1 deletions
|
@ -501,6 +501,7 @@ namespace MWMechanics
|
|||
state.mRecalcDynamicStats = mRecalcDynamicStats;
|
||||
state.mDrawState = mDrawState;
|
||||
state.mLevel = mLevel;
|
||||
state.mActorId = mActorId;
|
||||
|
||||
mSpells.writeState(state.mSpells);
|
||||
}
|
||||
|
@ -538,6 +539,7 @@ namespace MWMechanics
|
|||
mRecalcDynamicStats = state.mRecalcDynamicStats;
|
||||
mDrawState = DrawState_(state.mDrawState);
|
||||
mLevel = state.mLevel;
|
||||
mActorId = state.mActorId;
|
||||
|
||||
mSpells.readState(state.mSpells);
|
||||
}
|
||||
|
@ -579,4 +581,16 @@ namespace MWMechanics
|
|||
{
|
||||
sActorId = 0;
|
||||
}
|
||||
|
||||
void CreatureStats::writeActorIdCounter (ESM::ESMWriter& esm)
|
||||
{
|
||||
esm.startRecord(ESM::REC_ACTC);
|
||||
esm.writeHNT("COUN", sActorId);
|
||||
esm.endRecord(ESM::REC_ACTC);
|
||||
}
|
||||
|
||||
void CreatureStats::readActorIdCounter (ESM::ESMReader& esm)
|
||||
{
|
||||
esm.getHNT(sActorId, "COUN");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,6 +238,9 @@ namespace MWMechanics
|
|||
|
||||
void readState (const ESM::CreatureStats& state);
|
||||
|
||||
static void writeActorIdCounter (ESM::ESMWriter& esm);
|
||||
static void readActorIdCounter (ESM::ESMReader& esm);
|
||||
|
||||
// Relates to NPC gold reset delay
|
||||
void setTradeTime(MWWorld::TimeStamp tradeTime);
|
||||
MWWorld::TimeStamp getTradeTime() const;
|
||||
|
|
|
@ -318,6 +318,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
|
|||
case ESM::REC_CSTA:
|
||||
case ESM::REC_WTHR:
|
||||
case ESM::REC_DYNA:
|
||||
case ESM::REC_ACTC:
|
||||
|
||||
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
|
||||
break;
|
||||
|
|
|
@ -274,7 +274,8 @@ namespace MWWorld
|
|||
+mStore.countSavedGameRecords()
|
||||
+mGlobalVariables.countSavedGameRecords()
|
||||
+1 // player record
|
||||
+1; // weather record
|
||||
+1 // weather record
|
||||
+1; // actorId counter
|
||||
}
|
||||
|
||||
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||
|
@ -287,6 +288,9 @@ namespace MWWorld
|
|||
mRendering->writeFog(cellstore);
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats::writeActorIdCounter(writer);
|
||||
progress.increaseProgress();
|
||||
|
||||
mCells.write (writer, progress);
|
||||
mStore.write (writer, progress);
|
||||
mGlobalVariables.write (writer, progress);
|
||||
|
@ -297,6 +301,12 @@ namespace MWWorld
|
|||
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||
const std::map<int, int>& contentFileMap)
|
||||
{
|
||||
if (type == ESM::REC_ACTC)
|
||||
{
|
||||
MWMechanics::CreatureStats::readActorIdCounter(reader);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mStore.readRecord (reader, type) &&
|
||||
!mGlobalVariables.readRecord (reader, type) &&
|
||||
!mPlayer->readRecord (reader, type) &&
|
||||
|
|
|
@ -72,6 +72,9 @@ void ESM::CreatureStats::load (ESMReader &esm)
|
|||
mLevel = 1;
|
||||
esm.getHNOT (mLevel, "LEVL");
|
||||
|
||||
mActorId = -1;
|
||||
esm.getHNOT (mActorId, "ACID");
|
||||
|
||||
mSpells.load(esm);
|
||||
}
|
||||
|
||||
|
@ -146,5 +149,8 @@ void ESM::CreatureStats::save (ESMWriter &esm) const
|
|||
if (mLevel != 1)
|
||||
esm.writeHNT ("LEVL", mLevel);
|
||||
|
||||
if (mActorId != -1)
|
||||
esm.writeHNT ("ACID", mActorId);
|
||||
|
||||
mSpells.save(esm);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace ESM
|
|||
|
||||
ESM::TimeStamp mTradeTime;
|
||||
int mGoldPool;
|
||||
int mActorId;
|
||||
|
||||
bool mDead;
|
||||
bool mDied;
|
||||
|
|
|
@ -108,6 +108,7 @@ enum RecNameInts
|
|||
REC_KEYS = FourCC<'K','E','Y','S'>::value,
|
||||
REC_DYNA = FourCC<'D','Y','N','A'>::value,
|
||||
REC_ASPL = FourCC<'A','S','P','L'>::value,
|
||||
REC_ACTC = FourCC<'A','C','T','C'>::value,
|
||||
|
||||
// format 1
|
||||
REC_FILT = 0x544C4946
|
||||
|
|
Loading…
Reference in a new issue