mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:53:51 +00:00
integrated name-lookup into ape's code; added missing implementation of a function
This commit is contained in:
parent
5827591d05
commit
052d049a6c
2 changed files with 26 additions and 3 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "mwworld/world.hpp"
|
#include "mwworld/world.hpp"
|
||||||
#include "mwworld/ptr.hpp"
|
#include "mwworld/ptr.hpp"
|
||||||
#include "mwworld/environment.hpp"
|
#include "mwworld/environment.hpp"
|
||||||
|
#include "mwworld/class.hpp"
|
||||||
|
|
||||||
#include "mwclass/classes.hpp"
|
#include "mwclass/classes.hpp"
|
||||||
|
|
||||||
|
@ -75,7 +76,20 @@ bool OMW::Engine::frameStarted(const Ogre::FrameEvent& evt)
|
||||||
{
|
{
|
||||||
std::pair<std::string, float> handle = mEnvironment.mWorld->getMWScene()->getFacedHandle();
|
std::pair<std::string, float> handle = mEnvironment.mWorld->getMWScene()->getFacedHandle();
|
||||||
|
|
||||||
std::cout << "Object: " << handle.first << ", distance: " << handle.second << std::endl;
|
std::string name;
|
||||||
|
|
||||||
|
if (!handle.first.empty())
|
||||||
|
{
|
||||||
|
// TODO compare handle.second with max activation range (from a GMST)
|
||||||
|
|
||||||
|
MWWorld::Ptr ptr = mEnvironment.mWorld->getPtrViaHandle (handle.first);
|
||||||
|
|
||||||
|
if (!ptr.isEmpty())
|
||||||
|
name = MWWorld::Class::get (ptr).getName (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!name.empty())
|
||||||
|
std::cout << "Object: " << name << ", distance: " << handle.second << std::endl;
|
||||||
|
|
||||||
focusFrameCounter = 0;
|
focusFrameCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,15 @@ namespace
|
||||||
ESMS::LiveCellRef<T, MWWorld::RefData> *searchViaHandle (const std::string& handle,
|
ESMS::LiveCellRef<T, MWWorld::RefData> *searchViaHandle (const std::string& handle,
|
||||||
ESMS::CellRefList<T, MWWorld::RefData>& refList)
|
ESMS::CellRefList<T, MWWorld::RefData>& refList)
|
||||||
{
|
{
|
||||||
|
typedef typename ESMS::CellRefList<T, MWWorld::RefData>::List::iterator iterator;
|
||||||
|
|
||||||
|
for (iterator iter (refList.list.begin()); iter!=refList.list.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (iter->mData.getHandle()==handle)
|
||||||
|
{
|
||||||
|
return &*iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue