a bit of cleanup

actorid
Marc Zinnschlag 11 years ago
parent f6a876bc3d
commit 9a1b5dc1c6

@ -497,6 +497,16 @@ namespace MWWorld
return false; return false;
} }
Ptr Scene::searchPtrViaHandle (const std::string& handle)
{
for (CellStoreCollection::const_iterator iter (mActiveCells.begin());
iter!=mActiveCells.end(); ++iter)
if (Ptr ptr = (*iter)->searchViaHandle (handle))
return ptr;
return Ptr();
}
Ptr Scene::searchPtrViaActorId (int actorId) Ptr Scene::searchPtrViaActorId (int actorId)
{ {
for (CellStoreCollection::const_iterator iter (mActiveCells.begin()); for (CellStoreCollection::const_iterator iter (mActiveCells.begin());

@ -103,6 +103,8 @@ namespace MWWorld
bool isCellActive(const CellStore &cell); bool isCellActive(const CellStore &cell);
Ptr searchPtrViaHandle (const std::string& handle);
Ptr searchPtrViaActorId (int actorId); Ptr searchPtrViaActorId (int actorId);
}; };
} }

@ -536,17 +536,8 @@ namespace MWWorld
{ {
if (mPlayer->getPlayer().getRefData().getHandle()==handle) if (mPlayer->getPlayer().getRefData().getHandle()==handle)
return mPlayer->getPlayer(); return mPlayer->getPlayer();
for (Scene::CellStoreCollection::const_iterator iter (mWorldScene->getActiveCells().begin());
iter!=mWorldScene->getActiveCells().end(); ++iter)
{
CellStore* cellstore = *iter;
Ptr ptr = cellstore->searchViaHandle (handle);
if (!ptr.isEmpty())
return ptr;
}
return MWWorld::Ptr(); return mWorldScene->searchPtrViaHandle (handle);
} }
Ptr World::searchPtrViaActorId (int actorId) Ptr World::searchPtrViaActorId (int actorId)

Loading…
Cancel
Save