Reworked the accusation of actors

actorid
Jeffrey Haines 11 years ago
parent c3e08916da
commit 42b879a9a5

@ -160,13 +160,11 @@ namespace MWBase
virtual bool isAIActive() = 0;
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects) = 0;
virtual void getActorsInRange(const Ogre::Vector3 &position, float radius, std::vector<MWWorld::Ptr> &objects) = 0;
///return the list of actors which are following the given actor (ie AiFollow is active and the target is the actor)
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor) = 0;
///return the list of actors
virtual MWMechanics::Actors& getActors() = 0;
virtual void playerLoaded() = 0;
};
}

@ -985,13 +985,13 @@ namespace MWMechanics
mObjects.getObjectsInRange(position, radius, objects);
}
std::list<MWWorld::Ptr> MechanicsManager::getActorsFollowing(const MWWorld::Ptr& actor)
void MechanicsManager::getActorsInRange(const Ogre::Vector3 &position, float radius, std::vector<MWWorld::Ptr> &objects)
{
return mActors.getActorsFollowing(actor);
mActors.getObjectsInRange(position, radius, objects);
}
MWMechanics::Actors& MechanicsManager::getActors()
std::list<MWWorld::Ptr> MechanicsManager::getActorsFollowing(const MWWorld::Ptr& actor)
{
return *mActors;
return mActors.getActorsFollowing(actor);
}
}

@ -134,11 +134,10 @@ namespace MWMechanics
virtual void updateMagicEffects (const MWWorld::Ptr& ptr);
virtual void getObjectsInRange (const Ogre::Vector3& position, float radius, std::vector<MWWorld::Ptr>& objects);
virtual void getActorsInRange(const Ogre::Vector3 &position, float radius, std::vector<MWWorld::Ptr> &objects);
virtual std::list<MWWorld::Ptr> getActorsFollowing(const MWWorld::Ptr& actor);
virtual MWMechanics::Actors& getActors();
virtual void toggleAI();
virtual bool isAIActive();

@ -134,14 +134,16 @@ namespace MWWorld
ptr.getClass().getCreatureStats(ptr).setMovementFlag(MWMechanics::CreatureStats::Flag_Sneak, sneak);
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
// Find all the actors who might be able to see the player
std::vector<MWWorld::Ptr> neighbors;
MWBase::Environment::get().getMechanicsManager()->getActors().getObjectsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
MWBase::Environment::get().getMechanicsManager()->getActorsInRange( Ogre::Vector3(ptr.getRefData().getPosition().pos),
esmStore.get<ESM::GameSetting>().find("fSneakUseDist")->getInt(), neighbors);
for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it)
if ( MechanicsManager::awarenessCheck(ptr, *it) )
if ( MWBase::Environment::get().getMechanicsManager()->awarenessCheck(ptr, *it) )
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
if (!neighbors)
if (!neighbors.size())
MWBase::Environment::get().getWindowManager()->setSneakVisibility(sneak);
}

Loading…
Cancel
Save