mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 22:19:54 +00:00
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
|
|
#include "actors.hpp"
|
|
|
|
#include "../mwworld/class.hpp"
|
|
|
|
namespace MWMechanics
|
|
{
|
|
Actors::Actors (MWWorld::Environment& environment) : mEnvironment (environment) {}
|
|
|
|
void Actors::addActor (const MWWorld::Ptr& ptr)
|
|
{
|
|
mActors.insert (ptr);
|
|
}
|
|
|
|
void Actors::removeActor (const MWWorld::Ptr& ptr)
|
|
{
|
|
mActors.erase (ptr);
|
|
}
|
|
|
|
void Actors::dropActors (const MWWorld::Ptr::CellStore *cellStore)
|
|
{
|
|
std::set<MWWorld::Ptr>::iterator iter = mActors.begin();
|
|
|
|
while (iter!=mActors.end())
|
|
if (iter->getCell()==cellStore)
|
|
{
|
|
mActors.erase (iter++);
|
|
}
|
|
else
|
|
++iter;
|
|
}
|
|
|
|
void Actors::update (std::vector<std::pair<std::string, Ogre::Vector3> >& movement)
|
|
{
|
|
for (std::set<MWWorld::Ptr>::iterator iter (mActors.begin()); iter!=mActors.end();
|
|
++iter)
|
|
{
|
|
Ogre::Vector3 vector = MWWorld::Class::get (*iter).getMovementVector (*iter);
|
|
|
|
if (vector!=Ogre::Vector3::ZERO)
|
|
movement.push_back (std::make_pair (iter->getRefData().getHandle(), vector));
|
|
}
|
|
}
|
|
}
|