1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-01 03:21:41 +00:00

Avoid duplicated emplace for interior cell store

This commit is contained in:
elsid 2023-07-23 18:24:55 +02:00
parent a16a5003d8
commit 1a7b4283e7
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

View File

@ -32,10 +32,10 @@ namespace MWWorld
CellStore& emplaceCellStore(ESM::RefId id, const T& cell, ESMStore& store, ESM::ReadersCache& readers,
std::unordered_map<ESM::RefId, CellStore>& cells)
{
return cells
.emplace(std::piecewise_construct, std::forward_as_tuple(id),
std::forward_as_tuple(Cell(cell), store, readers))
.first->second;
const auto [it, inserted] = cells.emplace(
std::piecewise_construct, std::forward_as_tuple(id), std::forward_as_tuple(Cell(cell), store, readers));
assert(inserted);
return it->second;
}
const ESM::Cell* createEsmCell(ESM::ExteriorCellLocation location, ESMStore& store)
@ -205,6 +205,7 @@ namespace MWWorld
cellStore = &emplaceCellStore(cell4->mId, *cell4, mStore, mReaders, mCells);
else
return nullptr;
mInteriors.emplace(name, cellStore);
}
else
{