mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-07 03:45:33 +00:00
Avoid duplicated emplace for interior cell store
This commit is contained in:
parent
a16a5003d8
commit
1a7b4283e7
1 changed files with 5 additions and 4 deletions
|
@ -32,10 +32,10 @@ namespace MWWorld
|
||||||
CellStore& emplaceCellStore(ESM::RefId id, const T& cell, ESMStore& store, ESM::ReadersCache& readers,
|
CellStore& emplaceCellStore(ESM::RefId id, const T& cell, ESMStore& store, ESM::ReadersCache& readers,
|
||||||
std::unordered_map<ESM::RefId, CellStore>& cells)
|
std::unordered_map<ESM::RefId, CellStore>& cells)
|
||||||
{
|
{
|
||||||
return cells
|
const auto [it, inserted] = cells.emplace(
|
||||||
.emplace(std::piecewise_construct, std::forward_as_tuple(id),
|
std::piecewise_construct, std::forward_as_tuple(id), std::forward_as_tuple(Cell(cell), store, readers));
|
||||||
std::forward_as_tuple(Cell(cell), store, readers))
|
assert(inserted);
|
||||||
.first->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ESM::Cell* createEsmCell(ESM::ExteriorCellLocation location, ESMStore& store)
|
const ESM::Cell* createEsmCell(ESM::ExteriorCellLocation location, ESMStore& store)
|
||||||
|
@ -205,6 +205,7 @@ namespace MWWorld
|
||||||
cellStore = &emplaceCellStore(cell4->mId, *cell4, mStore, mReaders, mCells);
|
cellStore = &emplaceCellStore(cell4->mId, *cell4, mStore, mReaders, mCells);
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
mInteriors.emplace(name, cellStore);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue