Store levitation/teleport enabled state in savegames (Fixes #1923)

deque
scrawl 10 years ago
parent 175d4f3d44
commit 45b4304237

@ -351,6 +351,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
case ESM::REC_ACTC:
case ESM::REC_PROJ:
case ESM::REC_MPRJ:
case ESM::REC_ENAB:
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
break;

@ -302,7 +302,8 @@ namespace MWWorld
+mProjectileManager->countSavedGameRecords()
+1 // player record
+1 // weather record
+1; // actorId counter
+1 // actorId counter
+1; // levitation/teleport enabled state
}
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
@ -325,25 +326,37 @@ namespace MWWorld
mPlayer->write (writer, progress);
mWeatherManager->write (writer, progress);
mProjectileManager->write (writer, progress);
writer.startRecord(ESM::REC_ENAB);
writer.writeHNT("TELE", mTeleportEnabled);
writer.writeHNT("LEVT", mLevitationEnabled);
writer.endRecord(ESM::REC_ENAB);
progress.increaseProgress();
}
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) &&
!mWeatherManager->readRecord (reader, type) &&
!mCells.readRecord (reader, type, contentFileMap) &&
!mProjectileManager->readRecord (reader, type))
switch (type)
{
throw std::runtime_error ("unknown record in saved game");
case ESM::REC_ACTC:
MWMechanics::CreatureStats::readActorIdCounter(reader);
return;
case ESM::REC_ENAB:
reader.getHNT(mTeleportEnabled, "TELE");
reader.getHNT(mLevitationEnabled, "LEVT");
return;
default:
if (!mStore.readRecord (reader, type) &&
!mGlobalVariables.readRecord (reader, type) &&
!mPlayer->readRecord (reader, type) &&
!mWeatherManager->readRecord (reader, type) &&
!mCells.readRecord (reader, type, contentFileMap) &&
!mProjectileManager->readRecord (reader, type))
{
throw std::runtime_error ("unknown record in saved game");
}
break;
}
}

@ -113,6 +113,7 @@ enum RecNameInts
REC_PROJ = FourCC<'P','R','O','J'>::value,
REC_DCOU = FourCC<'D','C','O','U'>::value,
REC_MARK = FourCC<'M','A','R','K'>::value,
REC_ENAB = FourCC<'E','N','A','B'>::value,
// format 1
REC_FILT = 0x544C4946,

Loading…
Cancel
Save