a bit of cleanup

This commit is contained in:
Marc Zinnschlag 2014-04-29 15:32:00 +02:00
parent f6a876bc3d
commit 9a1b5dc1c6
3 changed files with 13 additions and 10 deletions

View file

@ -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());

View file

@ -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);
}; };
} }

View file

@ -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 mWorldScene->searchPtrViaHandle (handle);
return ptr;
}
return MWWorld::Ptr();
} }
Ptr World::searchPtrViaActorId (int actorId) Ptr World::searchPtrViaActorId (int actorId)