forked from mirror/openmw-tes3mp
[Client] Add searchPtrViaRefIndex method to World to easily find objects
This commit is contained in:
parent
c984fc0881
commit
0f30e21312
3 changed files with 44 additions and 0 deletions
|
@ -184,6 +184,16 @@ namespace MWBase
|
|||
virtual MWWorld::Ptr searchPtrViaActorId (int actorId) = 0;
|
||||
///< Search is limited to the active cells.
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to find a Ptr in any active cell based on its refNumIndex and mpNum
|
||||
*/
|
||||
virtual MWWorld::Ptr searchPtrViaRefIndex(int refNumIndex, int mpNum) = 0;
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
virtual MWWorld::Ptr findContainer (const MWWorld::ConstPtr& ptr) = 0;
|
||||
///< Return a pointer to a liveCellRef which contains \a ptr.
|
||||
/// \note Search is limited to the active cells.
|
||||
|
|
|
@ -729,6 +729,30 @@ namespace MWWorld
|
|||
return mWorldScene->searchPtrViaActorId (actorId);
|
||||
}
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to find a Ptr in any active cell based on its refNumIndex and mpNum
|
||||
*/
|
||||
Ptr World::searchPtrViaRefIndex(int refNumIndex, int mpNum)
|
||||
{
|
||||
for (Scene::CellStoreCollection::const_iterator iter(mWorldScene->getActiveCells().begin());
|
||||
iter != mWorldScene->getActiveCells().end(); ++iter)
|
||||
{
|
||||
CellStore* cellStore = *iter;
|
||||
|
||||
MWWorld::Ptr ptrFound = cellStore->searchExact(refNumIndex, mpNum);
|
||||
|
||||
if (ptrFound)
|
||||
return ptrFound;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
struct FindContainerVisitor
|
||||
{
|
||||
ConstPtr mContainedPtr;
|
||||
|
|
|
@ -291,6 +291,16 @@ namespace MWWorld
|
|||
Ptr searchPtrViaActorId (int actorId) override;
|
||||
///< Search is limited to the active cells.
|
||||
|
||||
/*
|
||||
Start of tes3mp addition
|
||||
|
||||
Make it possible to find a Ptr in any active cell based on its refNumIndex and mpNum
|
||||
*/
|
||||
Ptr searchPtrViaRefIndex(int refNumIndex, int mpNum) override;
|
||||
/*
|
||||
End of tes3mp addition
|
||||
*/
|
||||
|
||||
MWWorld::Ptr findContainer (const MWWorld::ConstPtr& ptr) override;
|
||||
///< Return a pointer to a liveCellRef which contains \a ptr.
|
||||
/// \note Search is limited to the active cells.
|
||||
|
|
Loading…
Reference in a new issue