mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-09-11 13:25:53 -04:00
Store levitation/teleport enabled state in savegames (Fixes #1923)
This commit is contained in:
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_ACTC:
|
||||||
case ESM::REC_PROJ:
|
case ESM::REC_PROJ:
|
||||||
case ESM::REC_MPRJ:
|
case ESM::REC_MPRJ:
|
||||||
|
case ESM::REC_ENAB:
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
|
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
|
||||||
break;
|
break;
|
||||||
|
@ -302,7 +302,8 @@ namespace MWWorld
|
|||||||
+mProjectileManager->countSavedGameRecords()
|
+mProjectileManager->countSavedGameRecords()
|
||||||
+1 // player record
|
+1 // player record
|
||||||
+1 // weather 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
|
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
|
||||||
@ -325,25 +326,37 @@ namespace MWWorld
|
|||||||
mPlayer->write (writer, progress);
|
mPlayer->write (writer, progress);
|
||||||
mWeatherManager->write (writer, progress);
|
mWeatherManager->write (writer, progress);
|
||||||
mProjectileManager->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,
|
void World::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
const std::map<int, int>& contentFileMap)
|
const std::map<int, int>& contentFileMap)
|
||||||
{
|
{
|
||||||
if (type == ESM::REC_ACTC)
|
switch (type)
|
||||||
{
|
{
|
||||||
MWMechanics::CreatureStats::readActorIdCounter(reader);
|
case ESM::REC_ACTC:
|
||||||
return;
|
MWMechanics::CreatureStats::readActorIdCounter(reader);
|
||||||
}
|
return;
|
||||||
|
case ESM::REC_ENAB:
|
||||||
if (!mStore.readRecord (reader, type) &&
|
reader.getHNT(mTeleportEnabled, "TELE");
|
||||||
!mGlobalVariables.readRecord (reader, type) &&
|
reader.getHNT(mLevitationEnabled, "LEVT");
|
||||||
!mPlayer->readRecord (reader, type) &&
|
return;
|
||||||
!mWeatherManager->readRecord (reader, type) &&
|
default:
|
||||||
!mCells.readRecord (reader, type, contentFileMap) &&
|
if (!mStore.readRecord (reader, type) &&
|
||||||
!mProjectileManager->readRecord (reader, type))
|
!mGlobalVariables.readRecord (reader, type) &&
|
||||||
{
|
!mPlayer->readRecord (reader, type) &&
|
||||||
throw std::runtime_error ("unknown record in saved game");
|
!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_PROJ = FourCC<'P','R','O','J'>::value,
|
||||||
REC_DCOU = FourCC<'D','C','O','U'>::value,
|
REC_DCOU = FourCC<'D','C','O','U'>::value,
|
||||||
REC_MARK = FourCC<'M','A','R','K'>::value,
|
REC_MARK = FourCC<'M','A','R','K'>::value,
|
||||||
|
REC_ENAB = FourCC<'E','N','A','B'>::value,
|
||||||
|
|
||||||
// format 1
|
// format 1
|
||||||
REC_FILT = 0x544C4946,
|
REC_FILT = 0x544C4946,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user