mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 18:59:57 +00:00
Store levitation/teleport enabled state in savegames (Fixes #1923)
This commit is contained in:
parent
175d4f3d44
commit
45b4304237
3 changed files with 29 additions and 14 deletions
|
@ -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,17 +326,27 @@ 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)
|
||||
switch (type)
|
||||
{
|
||||
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) &&
|
||||
|
@ -345,6 +356,8 @@ namespace MWWorld
|
|||
{
|
||||
throw std::runtime_error ("unknown record in saved game");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void World::ensureNeededRecords()
|
||||
|
|
|
@ -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…
Reference in a new issue