mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-27 06:55:54 -04:00
Create SearchByRefNumCustomVisitor in CellStore that returns entire Ptr
This commit is contained in:
parent
b3d6dad0c5
commit
40f1db2d86
@ -168,6 +168,30 @@ namespace
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// Added by tes3mp
|
||||
template <typename PtrType>
|
||||
struct SearchByRefNumCustomVisitor
|
||||
{
|
||||
PtrType mFound;
|
||||
ESM::RefNum mRefNumToFind;
|
||||
|
||||
SearchByRefNumCustomVisitor(const ESM::RefNum& toFind)
|
||||
: mFound(NULL)
|
||||
, mRefNumToFind(toFind)
|
||||
{
|
||||
}
|
||||
|
||||
bool operator()(const PtrType& ptr)
|
||||
{
|
||||
if (ptr.getCellRef().getRefNum() == mRefNumToFind)
|
||||
{
|
||||
mFound = ptr;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
@ -436,7 +460,7 @@ namespace MWWorld
|
||||
// Added by tes3mp
|
||||
Ptr CellStore::searchByRefNum (ESM::RefNum refNum)
|
||||
{
|
||||
SearchByRefNumVisitor searchVisitor(refNum);
|
||||
SearchByRefNumCustomVisitor<MWWorld::Ptr> searchVisitor(refNum);
|
||||
forEach(searchVisitor);
|
||||
return searchVisitor.mFound;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user