mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
encapsulated mState
This commit is contained in:
parent
7693f712bc
commit
8ea686c6c8
3 changed files with 14 additions and 7 deletions
|
@ -80,7 +80,7 @@ void MWWorld::Cells::writeCell (ESM::ESMWriter& writer, const CellStore& cell) c
|
||||||
|
|
||||||
bool MWWorld::Cells::hasState (const CellStore& cellStore) const
|
bool MWWorld::Cells::hasState (const CellStore& cellStore) const
|
||||||
{
|
{
|
||||||
if (cellStore.mState==CellStore::State_Loaded)
|
if (cellStore.getState()==CellStore::State_Loaded)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (cellStore.getCell()->mData.mFlags & ESM::Cell::Interior)
|
if (cellStore.getCell()->mData.mFlags & ESM::Cell::Interior)
|
||||||
|
@ -122,7 +122,7 @@ MWWorld::CellStore *MWWorld::Cells::getExterior (int x, int y)
|
||||||
std::make_pair (x, y), CellStore (cell))).first;
|
std::make_pair (x, y), CellStore (cell))).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->second.mState!=CellStore::State_Loaded)
|
if (result->second.getState()!=CellStore::State_Loaded)
|
||||||
{
|
{
|
||||||
// Multiple plugin support for landscape data is much easier than for references. The last plugin wins.
|
// Multiple plugin support for landscape data is much easier than for references. The last plugin wins.
|
||||||
result->second.load (mStore, mReader);
|
result->second.load (mStore, mReader);
|
||||||
|
@ -143,7 +143,7 @@ MWWorld::CellStore *MWWorld::Cells::getInterior (const std::string& name)
|
||||||
result = mInteriors.insert (std::make_pair (lowerName, CellStore (cell))).first;
|
result = mInteriors.insert (std::make_pair (lowerName, CellStore (cell))).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result->second.mState!=CellStore::State_Loaded)
|
if (result->second.getState()!=CellStore::State_Loaded)
|
||||||
{
|
{
|
||||||
result->second.load (mStore, mReader);
|
result->second.load (mStore, mReader);
|
||||||
}
|
}
|
||||||
|
@ -162,10 +162,10 @@ MWWorld::CellStore *MWWorld::Cells::getCell (const ESM::CellId& id)
|
||||||
MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, CellStore& cell,
|
MWWorld::Ptr MWWorld::Cells::getPtr (const std::string& name, CellStore& cell,
|
||||||
bool searchInContainers)
|
bool searchInContainers)
|
||||||
{
|
{
|
||||||
if (cell.mState==CellStore::State_Unloaded)
|
if (cell.getState()==CellStore::State_Unloaded)
|
||||||
cell.preload (mStore, mReader);
|
cell.preload (mStore, mReader);
|
||||||
|
|
||||||
if (cell.mState==CellStore::State_Preloaded)
|
if (cell.getState()==CellStore::State_Preloaded)
|
||||||
{
|
{
|
||||||
if (std::binary_search (cell.mIds.begin(), cell.mIds.end(), name))
|
if (std::binary_search (cell.mIds.begin(), cell.mIds.end(), name))
|
||||||
{
|
{
|
||||||
|
@ -375,7 +375,7 @@ bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, int32_t type,
|
||||||
state.load (reader);
|
state.load (reader);
|
||||||
cellStore->loadState (state);
|
cellStore->loadState (state);
|
||||||
|
|
||||||
if (cellStore->mState!=CellStore::State_Loaded)
|
if (cellStore->getState()!=CellStore::State_Loaded)
|
||||||
cellStore->load (mStore, mReader);
|
cellStore->load (mStore, mReader);
|
||||||
|
|
||||||
cellStore->readReferences (reader, contentFileMap);
|
cellStore->readReferences (reader, contentFileMap);
|
||||||
|
|
|
@ -150,6 +150,11 @@ namespace MWWorld
|
||||||
return mCell;
|
return mCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CellStore::State CellStore::getState() const
|
||||||
|
{
|
||||||
|
return mState;
|
||||||
|
}
|
||||||
|
|
||||||
void CellStore::load (const MWWorld::ESMStore &store, std::vector<ESM::ESMReader> &esm)
|
void CellStore::load (const MWWorld::ESMStore &store, std::vector<ESM::ESMReader> &esm)
|
||||||
{
|
{
|
||||||
if (mState!=State_Loaded)
|
if (mState!=State_Loaded)
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace MWWorld
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const ESM::Cell *mCell;
|
const ESM::Cell *mCell;
|
||||||
|
State mState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -69,7 +70,8 @@ namespace MWWorld
|
||||||
|
|
||||||
const ESM::Cell *getCell() const;
|
const ESM::Cell *getCell() const;
|
||||||
|
|
||||||
State mState;
|
State getState() const;
|
||||||
|
|
||||||
std::vector<std::string> mIds;
|
std::vector<std::string> mIds;
|
||||||
|
|
||||||
float mWaterLevel;
|
float mWaterLevel;
|
||||||
|
|
Loading…
Reference in a new issue