mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-09 06:36:42 +00:00
seperate permanent and non permanent exterior cells.
This commit is contained in:
parent
f731c5eadb
commit
1fdecaaa34
2 changed files with 16 additions and 10 deletions
|
@ -1116,25 +1116,29 @@ namespace MWWorld
|
||||||
ESM4::Cell* Store<ESM4::Cell>::insert(const ESM4::Cell& item, bool overrideOnly)
|
ESM4::Cell* Store<ESM4::Cell>::insert(const ESM4::Cell& item, bool overrideOnly)
|
||||||
{
|
{
|
||||||
auto cellPtr = TypedDynamicStore<ESM4::Cell>::insert(item, overrideOnly);
|
auto cellPtr = TypedDynamicStore<ESM4::Cell>::insert(item, overrideOnly);
|
||||||
if (!cellPtr->mEditorId.empty())
|
insertCell(cellPtr);
|
||||||
mCellNameIndex[cellPtr->mEditorId] = cellPtr;
|
|
||||||
if (cellPtr->isExterior())
|
|
||||||
{
|
|
||||||
mExteriors[{ cellPtr->mX, cellPtr->mY, cellPtr->mParent }] = cellPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cellPtr;
|
return cellPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM4::Cell* Store<ESM4::Cell>::insertStatic(const ESM4::Cell& item)
|
ESM4::Cell* Store<ESM4::Cell>::insertStatic(const ESM4::Cell& item)
|
||||||
{
|
{
|
||||||
auto cellPtr = TypedDynamicStore<ESM4::Cell>::insertStatic(item);
|
auto cellPtr = TypedDynamicStore<ESM4::Cell>::insertStatic(item);
|
||||||
|
insertCell(cellPtr);
|
||||||
|
return cellPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Store<ESM4::Cell>::insertCell(ESM4::Cell* cellPtr)
|
||||||
|
{
|
||||||
if (!cellPtr->mEditorId.empty())
|
if (!cellPtr->mEditorId.empty())
|
||||||
mCellNameIndex[cellPtr->mEditorId] = cellPtr;
|
mCellNameIndex[cellPtr->mEditorId] = cellPtr;
|
||||||
if (cellPtr->isExterior())
|
if (cellPtr->isExterior())
|
||||||
mExteriors[{ cellPtr->mX, cellPtr->mY, cellPtr->mParent }] = cellPtr;
|
{
|
||||||
|
ESM::ExteriorCellIndex cellindex = { cellPtr->mX, cellPtr->mY, cellPtr->mParent };
|
||||||
return cellPtr;
|
if (cellPtr->mCellFlags & ESM4::Rec_Persistent)
|
||||||
|
mPersistentExteriors[cellindex] = cellPtr;
|
||||||
|
else
|
||||||
|
mExteriors[cellindex] = cellPtr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Store<ESM4::Cell>::clearDynamic()
|
void Store<ESM4::Cell>::clearDynamic()
|
||||||
|
|
|
@ -286,12 +286,14 @@ namespace MWWorld
|
||||||
mCellNameIndex;
|
mCellNameIndex;
|
||||||
|
|
||||||
std::unordered_map<ESM::ExteriorCellIndex, ESM4::Cell*> mExteriors;
|
std::unordered_map<ESM::ExteriorCellIndex, ESM4::Cell*> mExteriors;
|
||||||
|
std::unordered_map<ESM::ExteriorCellIndex, ESM4::Cell*> mPersistentExteriors;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const ESM4::Cell* searchCellName(std::string_view) const;
|
const ESM4::Cell* searchCellName(std::string_view) const;
|
||||||
const ESM4::Cell* searchExterior(ESM::ExteriorCellIndex cellIndex) const;
|
const ESM4::Cell* searchExterior(ESM::ExteriorCellIndex cellIndex) const;
|
||||||
ESM4::Cell* insert(const ESM4::Cell& item, bool overrideOnly = false);
|
ESM4::Cell* insert(const ESM4::Cell& item, bool overrideOnly = false);
|
||||||
ESM4::Cell* insertStatic(const ESM4::Cell& item);
|
ESM4::Cell* insertStatic(const ESM4::Cell& item);
|
||||||
|
void insertCell(ESM4::Cell* cell);
|
||||||
void clearDynamic() override;
|
void clearDynamic() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue