mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Accept a ConstPtr in getLOS
This commit is contained in:
parent
029d467ea5
commit
a0fb31e3b1
7 changed files with 18 additions and 10 deletions
|
@ -414,7 +414,7 @@ namespace MWBase
|
|||
virtual void getItemsOwnedBy (const MWWorld::ConstPtr& npc, std::vector<MWWorld::Ptr>& out) = 0;
|
||||
///< get all items in active cells owned by this Npc
|
||||
|
||||
virtual bool getLOS(const MWWorld::Ptr& actor,const MWWorld::Ptr& targetActor) = 0;
|
||||
virtual bool getLOS(const MWWorld::ConstPtr& actor,const MWWorld::ConstPtr& targetActor) = 0;
|
||||
///< get Line of Sight (morrowind stupid implementation)
|
||||
|
||||
virtual float getDistToNearestRayHit(const osg::Vec3f& from, const osg::Vec3f& dir, float maxDist) = 0;
|
||||
|
|
|
@ -857,7 +857,7 @@ namespace MWPhysics
|
|||
const btCollisionObject* mMe;
|
||||
};
|
||||
|
||||
PhysicsSystem::RayResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::Ptr ignore, int mask, int group)
|
||||
PhysicsSystem::RayResult PhysicsSystem::castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::Ptr ignore, int mask, int group) const
|
||||
{
|
||||
btVector3 btFrom = toBullet(from);
|
||||
btVector3 btTo = toBullet(to);
|
||||
|
@ -865,7 +865,7 @@ namespace MWPhysics
|
|||
const btCollisionObject* me = NULL;
|
||||
if (!ignore.isEmpty())
|
||||
{
|
||||
Actor* actor = getActor(ignore);
|
||||
const Actor* actor = getActor(ignore);
|
||||
if (actor)
|
||||
me = actor->getCollisionObject();
|
||||
}
|
||||
|
@ -912,10 +912,10 @@ namespace MWPhysics
|
|||
return result;
|
||||
}
|
||||
|
||||
bool PhysicsSystem::getLineOfSight(const MWWorld::Ptr &actor1, const MWWorld::Ptr &actor2)
|
||||
bool PhysicsSystem::getLineOfSight(const MWWorld::ConstPtr &actor1, const MWWorld::ConstPtr &actor2) const
|
||||
{
|
||||
Actor* physactor1 = getActor(actor1);
|
||||
Actor* physactor2 = getActor(actor2);
|
||||
const Actor* physactor1 = getActor(actor1);
|
||||
const Actor* physactor2 = getActor(actor2);
|
||||
|
||||
if (!physactor1 || !physactor2)
|
||||
return false;
|
||||
|
|
|
@ -107,12 +107,12 @@ namespace MWPhysics
|
|||
|
||||
/// @param me Optional, a Ptr to ignore in the list of results
|
||||
RayResult castRay(const osg::Vec3f &from, const osg::Vec3f &to, MWWorld::Ptr ignore = MWWorld::Ptr(), int mask =
|
||||
CollisionType_World|CollisionType_HeightMap|CollisionType_Actor, int group=0xff);
|
||||
CollisionType_World|CollisionType_HeightMap|CollisionType_Actor, int group=0xff) const;
|
||||
|
||||
RayResult castSphere(const osg::Vec3f& from, const osg::Vec3f& to, float radius);
|
||||
|
||||
/// Return true if actor1 can see actor2.
|
||||
bool getLineOfSight(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2);
|
||||
bool getLineOfSight(const MWWorld::ConstPtr& actor1, const MWWorld::ConstPtr& actor2) const;
|
||||
|
||||
bool isOnGround (const MWWorld::Ptr& actor);
|
||||
|
||||
|
|
|
@ -118,6 +118,11 @@ namespace MWWorld
|
|||
return mBaseNode;
|
||||
}
|
||||
|
||||
const SceneUtil::PositionAttitudeTransform* RefData::getBaseNode() const
|
||||
{
|
||||
return mBaseNode;
|
||||
}
|
||||
|
||||
int RefData::getCount() const
|
||||
{
|
||||
return mCount;
|
||||
|
|
|
@ -75,6 +75,9 @@ namespace MWWorld
|
|||
/// Return base node (can be a null pointer).
|
||||
SceneUtil::PositionAttitudeTransform* getBaseNode();
|
||||
|
||||
/// Return base node (can be a null pointer).
|
||||
const SceneUtil::PositionAttitudeTransform* getBaseNode() const;
|
||||
|
||||
/// Set base node (can be a null pointer).
|
||||
void setBaseNode (SceneUtil::PositionAttitudeTransform* base);
|
||||
|
||||
|
|
|
@ -2317,7 +2317,7 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
bool World::getLOS(const MWWorld::Ptr& actor, const MWWorld::Ptr& targetActor)
|
||||
bool World::getLOS(const MWWorld::ConstPtr& actor, const MWWorld::ConstPtr& targetActor)
|
||||
{
|
||||
if (!targetActor.getRefData().isEnabled() || !actor.getRefData().isEnabled())
|
||||
return false; // cannot get LOS unless both NPC's are enabled
|
||||
|
|
|
@ -518,7 +518,7 @@ namespace MWWorld
|
|||
virtual void getItemsOwnedBy (const MWWorld::ConstPtr& npc, std::vector<MWWorld::Ptr>& out);
|
||||
///< get all items in active cells owned by this Npc
|
||||
|
||||
virtual bool getLOS(const MWWorld::Ptr& actor,const MWWorld::Ptr& targetActor);
|
||||
virtual bool getLOS(const MWWorld::ConstPtr& actor,const MWWorld::ConstPtr& targetActor);
|
||||
///< get Line of Sight (morrowind stupid implementation)
|
||||
|
||||
virtual float getDistToNearestRayHit(const osg::Vec3f& from, const osg::Vec3f& dir, float maxDist);
|
||||
|
|
Loading…
Reference in a new issue