|
|
|
@ -38,29 +38,6 @@ namespace MWWorld
|
|
|
|
|
/// \brief Cell container
|
|
|
|
|
class WorldModel
|
|
|
|
|
{
|
|
|
|
|
typedef std::vector<std::pair<ESM::RefId, CellStore*>> IdCache;
|
|
|
|
|
const MWWorld::ESMStore& mStore;
|
|
|
|
|
ESM::ReadersCache& mReaders;
|
|
|
|
|
mutable std::unordered_map<ESM::RefId, CellStore> mCells;
|
|
|
|
|
mutable std::map<std::string, CellStore*, Misc::StringUtils::CiComp> mInteriors;
|
|
|
|
|
|
|
|
|
|
mutable std::map<ESM::ExteriorCellLocation, CellStore*> mExteriors;
|
|
|
|
|
IdCache mIdCache;
|
|
|
|
|
std::size_t mIdCacheIndex = 0;
|
|
|
|
|
std::unordered_map<ESM::RefNum, Ptr> mPtrIndex;
|
|
|
|
|
std::size_t mPtrIndexUpdateCounter = 0;
|
|
|
|
|
ESM::RefNum mLastGeneratedRefnum;
|
|
|
|
|
|
|
|
|
|
CellStore& getOrInsertCellStore(const ESM::Cell& cell);
|
|
|
|
|
|
|
|
|
|
CellStore& insertCellStore(const ESM::Cell& cell);
|
|
|
|
|
|
|
|
|
|
CellStore* getInteriorOrNull(std::string_view name);
|
|
|
|
|
|
|
|
|
|
Ptr getPtrAndCache(const ESM::RefId& name, CellStore& cellStore);
|
|
|
|
|
|
|
|
|
|
void writeCell(ESM::ESMWriter& writer, CellStore& cell) const;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit WorldModel(const MWWorld::ESMStore& store, ESM::ReadersCache& reader);
|
|
|
|
|
|
|
|
|
@ -111,6 +88,30 @@ namespace MWWorld
|
|
|
|
|
void write(ESM::ESMWriter& writer, Loading::Listener& progress) const;
|
|
|
|
|
|
|
|
|
|
bool readRecord(ESM::ESMReader& reader, uint32_t type, const std::map<int, int>& contentFileMap);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
using IdCache = std::vector<std::pair<ESM::RefId, CellStore*>>;
|
|
|
|
|
|
|
|
|
|
const MWWorld::ESMStore& mStore;
|
|
|
|
|
ESM::ReadersCache& mReaders;
|
|
|
|
|
mutable std::unordered_map<ESM::RefId, CellStore> mCells;
|
|
|
|
|
mutable std::map<std::string, CellStore*, Misc::StringUtils::CiComp> mInteriors;
|
|
|
|
|
mutable std::map<ESM::ExteriorCellLocation, CellStore*> mExteriors;
|
|
|
|
|
IdCache mIdCache;
|
|
|
|
|
std::size_t mIdCacheIndex = 0;
|
|
|
|
|
std::unordered_map<ESM::RefNum, Ptr> mPtrIndex;
|
|
|
|
|
std::size_t mPtrIndexUpdateCounter = 0;
|
|
|
|
|
ESM::RefNum mLastGeneratedRefnum;
|
|
|
|
|
|
|
|
|
|
CellStore& getOrInsertCellStore(const ESM::Cell& cell);
|
|
|
|
|
|
|
|
|
|
CellStore& insertCellStore(const ESM::Cell& cell);
|
|
|
|
|
|
|
|
|
|
CellStore* getInteriorOrNull(std::string_view name);
|
|
|
|
|
|
|
|
|
|
Ptr getPtrAndCache(const ESM::RefId& name, CellStore& cellStore);
|
|
|
|
|
|
|
|
|
|
void writeCell(ESM::ESMWriter& writer, CellStore& cell) const;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|