mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 14:23:53 +00:00
Merge pull request #2574 from Capostrophic/cellrefid
Avoid copying strings in SearchVisitor and readReferenceCollection (#5195)
This commit is contained in:
commit
9655da81a7
3 changed files with 10 additions and 2 deletions
|
@ -25,6 +25,11 @@ namespace MWWorld
|
|||
return mCellRef.mRefID;
|
||||
}
|
||||
|
||||
const std::string* CellRef::getRefIdPtr() const
|
||||
{
|
||||
return &mCellRef.mRefID;
|
||||
}
|
||||
|
||||
bool CellRef::getTeleport() const
|
||||
{
|
||||
return mCellRef.mTeleport;
|
||||
|
|
|
@ -34,6 +34,9 @@ namespace MWWorld
|
|||
// Id of object being referenced
|
||||
std::string getRefId() const;
|
||||
|
||||
// Pointer to ID of the object being referenced
|
||||
const std::string* getRefIdPtr() const;
|
||||
|
||||
// For doors - true if this door teleports to somewhere else, false
|
||||
// if it should open through animation.
|
||||
bool getTeleport() const;
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace
|
|||
{
|
||||
for (typename MWWorld::CellRefList<T>::List::iterator iter (collection.mList.begin());
|
||||
iter!=collection.mList.end(); ++iter)
|
||||
if (iter->mRef.getRefNum()==state.mRef.mRefNum && iter->mRef.getRefId() == state.mRef.mRefID)
|
||||
if (iter->mRef.getRefNum()==state.mRef.mRefNum && *iter->mRef.getRefIdPtr() == state.mRef.mRefID)
|
||||
{
|
||||
// overwrite existing reference
|
||||
iter->load (state);
|
||||
|
@ -390,7 +390,7 @@ namespace MWWorld
|
|||
const std::string *mIdToFind;
|
||||
bool operator()(const PtrType& ptr)
|
||||
{
|
||||
if (ptr.getCellRef().getRefId() == *mIdToFind)
|
||||
if (*ptr.getCellRef().getRefIdPtr() == *mIdToFind)
|
||||
{
|
||||
mFound = ptr;
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue