mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 18:11:35 +00:00
fix oblivion and skyrim
This commit is contained in:
parent
34dd24b261
commit
464092e323
2 changed files with 7 additions and 4 deletions
|
@ -766,20 +766,21 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
auto stream = Files::openBinaryInputFileStream(cell.mReaderContext.filename);
|
auto stream = Files::openBinaryInputFileStream(cell.mReaderContext.filename);
|
||||||
const ESM::Format format = ESM::readFormat(*stream);
|
const ESM::Format format = ESM::readFormat(*stream);
|
||||||
assert(format == ESM::Tes4);
|
assert(format == ESM::Format::Tes4);
|
||||||
stream->seekg(0);
|
stream->seekg(0);
|
||||||
|
|
||||||
ESM4::Reader readerESM4(
|
ESM4::Reader readerESM4(
|
||||||
std::move(stream), cell.mReaderContext.filename, MWBase::Environment::get().getResourceSystem()->getVFS());
|
std::move(stream), cell.mReaderContext.filename, MWBase::Environment::get().getResourceSystem()->getVFS());
|
||||||
|
|
||||||
readerESM4.setEncoder(readers.getStatelessEncoder());
|
readerESM4.setEncoder(readers.getStatelessEncoder());
|
||||||
bool contextValid = cell.mReaderContext.filePos != -1;
|
bool contextValid = cell.mReaderContext.filePos != std::numeric_limits<std::size_t>::max();
|
||||||
if (contextValid)
|
if (contextValid)
|
||||||
readerESM4.restoreContext(cell.mReaderContext);
|
readerESM4.restoreContext(cell.mReaderContext);
|
||||||
|
|
||||||
while ((ESM::RefId::formIdRefId(readerESM4.getContext().currCell) == cell.mId || !contextValid)
|
while ((ESM::RefId::formIdRefId(readerESM4.getContext().currCell) == cell.mId || !contextValid)
|
||||||
&& readerESM4.hasMoreRecs())
|
&& readerESM4.hasMoreRecs())
|
||||||
{
|
{
|
||||||
|
if (!contextValid)
|
||||||
readerESM4.exitGroupCheck();
|
readerESM4.exitGroupCheck();
|
||||||
if (!ESM4::ReaderUtils::readItem(
|
if (!ESM4::ReaderUtils::readItem(
|
||||||
readerESM4,
|
readerESM4,
|
||||||
|
@ -788,6 +789,7 @@ namespace MWWorld
|
||||||
ESM::RecNameInts esm4RecName = static_cast<ESM::RecNameInts>(ESM::esm4Recname(recordType));
|
ESM::RecNameInts esm4RecName = static_cast<ESM::RecNameInts>(ESM::esm4Recname(recordType));
|
||||||
if (esm4RecName == ESM::RecNameInts::REC_REFR4 && contextValid)
|
if (esm4RecName == ESM::RecNameInts::REC_REFR4 && contextValid)
|
||||||
{
|
{
|
||||||
|
reader.getRecordData();
|
||||||
ESM4::Reference ref;
|
ESM4::Reference ref;
|
||||||
ref.load(reader);
|
ref.load(reader);
|
||||||
invocable(ref);
|
invocable(ref);
|
||||||
|
@ -795,6 +797,7 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
else if (esm4RecName == ESM::RecNameInts::REC_CELL4)
|
else if (esm4RecName == ESM::RecNameInts::REC_CELL4)
|
||||||
{
|
{
|
||||||
|
reader.getRecordData();
|
||||||
ESM4::Cell cellToLoad;
|
ESM4::Cell cellToLoad;
|
||||||
cellToLoad.load(reader); // This is necessary to exit or to find the correct cell
|
cellToLoad.load(reader); // This is necessary to exit or to find the correct cell
|
||||||
if (cellToLoad.mId == cell.mId)
|
if (cellToLoad.mId == cell.mId)
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace ESM4
|
||||||
ReaderContext Reader::getContext()
|
ReaderContext Reader::getContext()
|
||||||
{
|
{
|
||||||
mCtx.filePos = mStream->tellg();
|
mCtx.filePos = mStream->tellg();
|
||||||
if (mCtx.filePos == -1)
|
if (mCtx.filePos == std::numeric_limits<std::size_t>::max())
|
||||||
return mCtx;
|
return mCtx;
|
||||||
mCtx.filePos -= mCtx.recHeaderSize; // update file position
|
mCtx.filePos -= mCtx.recHeaderSize; // update file position
|
||||||
return mCtx;
|
return mCtx;
|
||||||
|
|
Loading…
Reference in a new issue