mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 11:45:33 +00:00
Convert RefNum index map to use find().
This commit is contained in:
parent
a967418a5a
commit
68e16b6cee
3 changed files with 7 additions and 12 deletions
|
@ -104,7 +104,7 @@ namespace CSMWorld
|
|||
const ESM::Dialogue *mDialogue; // last loaded dialogue
|
||||
bool mBase;
|
||||
bool mProject;
|
||||
std::map<std::string, std::map<ESM::RefNum, std::string> > mRefLoadCache;
|
||||
std::map<std::string, std::map<unsigned int, std::string> > mRefLoadCache;
|
||||
int mReaderIndex;
|
||||
|
||||
std::vector<boost::shared_ptr<ESM::ESMReader> > mReaders;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "record.hpp"
|
||||
|
||||
void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool base,
|
||||
std::map<ESM::RefNum, std::string>& cache, CSMDoc::Messages& messages)
|
||||
std::map<unsigned int, std::string>& cache, CSMDoc::Messages& messages)
|
||||
{
|
||||
Record<Cell> cell = mCells.getRecord (cellIndex);
|
||||
|
||||
|
@ -71,13 +71,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
else
|
||||
ref.mCell = cell2.mId;
|
||||
|
||||
// ignore content file number
|
||||
std::map<ESM::RefNum, std::string>::iterator iter = cache.begin();
|
||||
for (; iter != cache.end(); ++iter)
|
||||
{
|
||||
if (ref.mRefNum.mIndex == iter->first.mIndex)
|
||||
break;
|
||||
}
|
||||
std::map<unsigned int, std::string>::iterator iter = cache.find (ref.mRefNum.mIndex);
|
||||
|
||||
if (isDeleted)
|
||||
{
|
||||
|
@ -114,11 +108,12 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
|||
|
||||
std::unique_ptr<Record<CellRef> > record(new Record<CellRef>);
|
||||
record->mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
|
||||
cache.insert (std::make_pair (ref.mRefNum.mIndex, ref.mId));
|
||||
|
||||
(base ? record->mBase : record->mModified) = std::move(ref);
|
||||
|
||||
appendRecord(std::move(record));
|
||||
|
||||
cache.insert (std::make_pair (ref.mRefNum, ref.mId));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace CSMWorld
|
|||
{}
|
||||
|
||||
void load (ESM::ESMReader& reader, int cellIndex, bool base,
|
||||
std::map<ESM::RefNum, std::string>& cache, CSMDoc::Messages& messages);
|
||||
std::map<unsigned int, std::string>& cache, CSMDoc::Messages& messages);
|
||||
///< Load a sequence of references.
|
||||
|
||||
std::string getNewId();
|
||||
|
|
Loading…
Reference in a new issue