mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-05 11:45:34 +00:00
fixed referenceable-loading in case of more than one content file
This commit is contained in:
parent
7b8802588e
commit
0afa61eed5
3 changed files with 19 additions and 16 deletions
|
@ -432,7 +432,7 @@ void CSMWorld::RefIdCollection::removeRows (int index, int count)
|
||||||
|
|
||||||
void CSMWorld::RefIdCollection::appendBlankRecord (const std::string& id, UniversalId::Type type)
|
void CSMWorld::RefIdCollection::appendBlankRecord (const std::string& id, UniversalId::Type type)
|
||||||
{
|
{
|
||||||
mData.appendRecord (type, id);
|
mData.appendRecord (type, id, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CSMWorld::RefIdCollection::searchId (const std::string& id) const
|
int CSMWorld::RefIdCollection::searchId (const std::string& id) const
|
||||||
|
@ -467,7 +467,7 @@ void CSMWorld::RefIdCollection::appendRecord (const RecordBase& record,
|
||||||
|
|
||||||
int index = mData.getAppendIndex (type);
|
int index = mData.getAppendIndex (type);
|
||||||
|
|
||||||
mData.appendRecord (type, id);
|
mData.appendRecord (type, id, false);
|
||||||
|
|
||||||
mData.getRecord (mData.globalToLocalIndex (index)).assign (record);
|
mData.getRecord (mData.globalToLocalIndex (index)).assign (record);
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ void CSMWorld::RefIdCollection::load (ESM::ESMReader& reader, bool base, Univers
|
||||||
{
|
{
|
||||||
// new record
|
// new record
|
||||||
int index = mData.getAppendIndex (type);
|
int index = mData.getAppendIndex (type);
|
||||||
mData.appendRecord (type, id);
|
mData.appendRecord (type, id, base);
|
||||||
|
|
||||||
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (index);
|
RefIdData::LocalIndex localIndex = mData.globalToLocalIndex (index);
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ CSMWorld::RecordBase& CSMWorld::RefIdData::getRecord (const LocalIndex& index)
|
||||||
return iter->second->getRecord (index.first);
|
return iter->second->getRecord (index.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::RefIdData::appendRecord (UniversalId::Type type, const std::string& id)
|
void CSMWorld::RefIdData::appendRecord (UniversalId::Type type, const std::string& id, bool base)
|
||||||
{
|
{
|
||||||
std::map<UniversalId::Type, RefIdDataContainerBase *>::iterator iter =
|
std::map<UniversalId::Type, RefIdDataContainerBase *>::iterator iter =
|
||||||
mRecordContainers.find (type);
|
mRecordContainers.find (type);
|
||||||
|
@ -139,7 +139,7 @@ void CSMWorld::RefIdData::appendRecord (UniversalId::Type type, const std::strin
|
||||||
if (iter==mRecordContainers.end())
|
if (iter==mRecordContainers.end())
|
||||||
throw std::logic_error ("invalid local index type");
|
throw std::logic_error ("invalid local index type");
|
||||||
|
|
||||||
iter->second->appendRecord (id);
|
iter->second->appendRecord (id, base);
|
||||||
|
|
||||||
mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (id),
|
mIndex.insert (std::make_pair (Misc::StringUtils::lowerCase (id),
|
||||||
LocalIndex (iter->second->getSize()-1, type)));
|
LocalIndex (iter->second->getSize()-1, type)));
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual RecordBase& getRecord (int index)= 0;
|
virtual RecordBase& getRecord (int index)= 0;
|
||||||
|
|
||||||
virtual void appendRecord (const std::string& id) = 0;
|
virtual void appendRecord (const std::string& id, bool base) = 0;
|
||||||
|
|
||||||
virtual void insertRecord (RecordBase& record) = 0;
|
virtual void insertRecord (RecordBase& record) = 0;
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
virtual RecordBase& getRecord (int index);
|
virtual RecordBase& getRecord (int index);
|
||||||
|
|
||||||
virtual void appendRecord (const std::string& id);
|
virtual void appendRecord (const std::string& id, bool base);
|
||||||
|
|
||||||
virtual void insertRecord (RecordBase& record);
|
virtual void insertRecord (RecordBase& record);
|
||||||
|
|
||||||
|
@ -108,12 +108,15 @@ namespace CSMWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename RecordT>
|
template<typename RecordT>
|
||||||
void RefIdDataContainer<RecordT>::appendRecord (const std::string& id)
|
void RefIdDataContainer<RecordT>::appendRecord (const std::string& id, bool base)
|
||||||
{
|
{
|
||||||
Record<RecordT> record;
|
Record<RecordT> record;
|
||||||
|
|
||||||
|
record.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||||
|
|
||||||
|
record.mBase.mId = id;
|
||||||
record.mModified.mId = id;
|
record.mModified.mId = id;
|
||||||
record.mModified.blank();
|
(base ? record.mBase : record.mModified).blank();
|
||||||
record.mState = RecordBase::State_ModifiedOnly;
|
|
||||||
|
|
||||||
mContainer.push_back (record);
|
mContainer.push_back (record);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +216,7 @@ namespace CSMWorld
|
||||||
|
|
||||||
RecordBase& getRecord (const LocalIndex& index);
|
RecordBase& getRecord (const LocalIndex& index);
|
||||||
|
|
||||||
void appendRecord (UniversalId::Type type, const std::string& id);
|
void appendRecord (UniversalId::Type type, const std::string& id, bool base);
|
||||||
|
|
||||||
int getAppendIndex (UniversalId::Type type) const;
|
int getAppendIndex (UniversalId::Type type) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue