mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 04:36:39 +00:00
Remove preloading logic from ESM4::Cell
This logic does not belong here. If client of ESM4::Cell needs to cache load results it can be done separately.
This commit is contained in:
parent
13c970b37a
commit
2c9b6fffe5
2 changed files with 8 additions and 29 deletions
|
@ -43,7 +43,14 @@ ESM4::Cell::~Cell()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ESM4::Cell::init(ESM4::Reader& reader)
|
// TODO: Try loading only EDID and XCLC (along with mFormId, mFlags and mParent)
|
||||||
|
//
|
||||||
|
// But, for external cells we may be scanning the whole record since we don't know if there is
|
||||||
|
// going to be an EDID subrecord. And the vast majority of cells are these kinds.
|
||||||
|
//
|
||||||
|
// So perhaps some testing needs to be done to see if scanning and skipping takes
|
||||||
|
// longer/shorter/same as loading the subrecords.
|
||||||
|
void ESM4::Cell::load(ESM4::Reader& reader)
|
||||||
{
|
{
|
||||||
mFormId = reader.hdr().record.id;
|
mFormId = reader.hdr().record.id;
|
||||||
reader.adjustFormId(mFormId);
|
reader.adjustFormId(mFormId);
|
||||||
|
@ -64,33 +71,10 @@ void ESM4::Cell::init(ESM4::Reader& reader)
|
||||||
currCellGrid.grid.y = 0;
|
currCellGrid.grid.y = 0;
|
||||||
reader.setCurrCellGrid(currCellGrid); // side effect: sets mCellGridValid true
|
reader.setCurrCellGrid(currCellGrid); // side effect: sets mCellGridValid true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Try loading only EDID and XCLC (along with mFormId, mFlags and mParent)
|
|
||||||
//
|
|
||||||
// But, for external cells we may be scanning the whole record since we don't know if there is
|
|
||||||
// going to be an EDID subrecord. And the vast majority of cells are these kinds.
|
|
||||||
//
|
|
||||||
// So perhaps some testing needs to be done to see if scanning and skipping takes
|
|
||||||
// longer/shorter/same as loading the subrecords.
|
|
||||||
bool ESM4::Cell::preload(ESM4::Reader& reader)
|
|
||||||
{
|
|
||||||
if (!mPreloaded)
|
|
||||||
load(reader);
|
|
||||||
|
|
||||||
mPreloaded = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ESM4::Cell::load(ESM4::Reader& reader)
|
|
||||||
{
|
|
||||||
if (mPreloaded)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// WARN: we need to call setCurrCell (and maybe setCurrCellGrid?) again before loading
|
// WARN: we need to call setCurrCell (and maybe setCurrCellGrid?) again before loading
|
||||||
// cell child groups if we are loading them after restoring the context
|
// cell child groups if we are loading them after restoring the context
|
||||||
// (may be easier to update the context before saving?)
|
// (may be easier to update the context before saving?)
|
||||||
init(reader);
|
|
||||||
reader.setCurrCell(mFormId); // save for LAND (and other children) to access later
|
reader.setCurrCell(mFormId); // save for LAND (and other children) to access later
|
||||||
std::uint32_t esmVer = reader.esmVersion();
|
std::uint32_t esmVer = reader.esmVersion();
|
||||||
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
|
||||||
|
|
|
@ -93,11 +93,6 @@ namespace ESM4
|
||||||
|
|
||||||
virtual ~Cell();
|
virtual ~Cell();
|
||||||
|
|
||||||
void init(ESM4::Reader& reader); // common setup for both preload() and load()
|
|
||||||
|
|
||||||
bool mPreloaded;
|
|
||||||
bool preload(ESM4::Reader& reader);
|
|
||||||
|
|
||||||
virtual void load(ESM4::Reader& reader);
|
virtual void load(ESM4::Reader& reader);
|
||||||
//virtual void save(ESM4::Writer& writer) const;
|
//virtual void save(ESM4::Writer& writer) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue