1 #ifndef GAME_MWMECHANICS_PATHFINDING_H
2 #define GAME_MWMECHANICS_PATHFINDING_H
31 bool checkWayIsClear(
const osg::Vec3f& from,
const osg::Vec3f& to,
float offsetXY);
40 static float sgn(
float val)
69 return !
mPath.empty();
77 const std::list<ESM::Pathgrid::Point>&
getPath()
const
96 mPath.push_back(point);
102 return ESM::Pathgrid::Point(static_cast<int>(v[0]), static_cast<int>(v[1]), static_cast<int>(v[2]));
113 return osg::Vec3f(static_cast<float>(p.
mX), static_cast<float>(p.
mY), static_cast<float>(p.
mZ));
133 assert(grid && !grid->
mPoints.empty());
136 int closestIndex = 0;
140 for(
unsigned int counter = 1; counter < grid->
mPoints.size(); counter++)
143 if(potentialDistBetween < distanceBetween)
145 distanceBetween = potentialDistBetween;
146 closestIndex = counter;
154 std::list<ESM::Pathgrid::Point>
mPath;
const MWWorld::CellStore * getPathCell() const
Definition: pathfinding.cpp:331
float getZAngleToNext(float x, float y) const
In radians.
Definition: pathfinding.cpp:256
float pos[3]
Definition: defs.hpp:40
static int sgn(int a)
Definition: pathfinding.hpp:47
void buildSyncedPath(const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint, const MWWorld::CellStore *cell)
Definition: pathfinding.cpp:302
PathFinder()
Definition: pathfinding.cpp:122
const std::list< ESM::Pathgrid::Point > & getPath() const
Definition: pathfinding.hpp:77
Definition: pathfinding.hpp:33
static const int PathTolerance
Definition: pathfinding.hpp:38
const MWWorld::CellStore * mCell
Definition: pathfinding.hpp:157
int mX
Definition: loadpgrd.hpp:32
const ESM::Pathgrid * mPathgrid
Definition: pathfinding.hpp:156
PointList mPoints
Definition: loadpgrd.hpp:51
bool isPathConstructed() const
Definition: pathfinding.hpp:67
const float PATHFIND_SHORTCUT_RETRY_DIST
Definition: pathfinding.hpp:27
Mutable state of a cell.
Definition: cellstore.hpp:53
static float sgn(float val)
Definition: pathfinding.hpp:40
bool checkWayIsClear(const osg::Vec3f &from, const osg::Vec3f &to, float offsetXY)
Definition: pathfinding.cpp:108
static osg::Vec3f MakeOsgVec3(const ESM::Pathgrid::Point &p)
Definition: pathfinding.hpp:111
void clearPath()
Definition: pathfinding.cpp:128
float distance(const ESM::Pathgrid::Point &point, float x, float y, float z)
Definition: pathfinding.cpp:69
static ESM::Pathgrid::Point MakePathgridPoint(const osg::Vec3f &v)
utility function to convert a osg::Vec3f to a Pathgrid::Point
Definition: pathfinding.hpp:100
Definition: loadpgrd.hpp:16
void addPointToPath(const ESM::Pathgrid::Point &point)
Definition: pathfinding.hpp:94
static int GetClosestPoint(const ESM::Pathgrid *grid, const osg::Vec3f &pos)
Definition: pathfinding.hpp:131
int mY
Definition: loadpgrd.hpp:32
float getZAngleToDir(const osg::Vec3f &dir)
Definition: pathfinding.cpp:85
float getXAngleToPoint(const ESM::Pathgrid::Point &origin, const ESM::Pathgrid::Point &dest)
Definition: pathfinding.cpp:102
static float DistanceSquared(ESM::Pathgrid::Point point, const osg::Vec3f &pos)
Definition: pathfinding.hpp:120
int mZ
Definition: loadpgrd.hpp:32
float getXAngleToDir(const osg::Vec3f &dir)
Definition: pathfinding.cpp:90
Definition: loadpgrd.hpp:30
static ESM::Pathgrid::Point MakePathgridPoint(const ESM::Position &p)
utility function to convert an ESM::Position to a Pathgrid::Point
Definition: pathfinding.hpp:106
float getZAngleToPoint(const ESM::Pathgrid::Point &origin, const ESM::Pathgrid::Point &dest)
Definition: pathfinding.cpp:96
void buildPath(const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint, const MWWorld::CellStore *cell)
Definition: pathfinding.cpp:170
int getPathSize() const
Definition: pathfinding.hpp:72
bool checkPathCompleted(float x, float y, float tolerance=PathTolerance)
true if we are within tolerance units of the last path point.
Definition: pathfinding.cpp:283
std::list< ESM::Pathgrid::Point > mPath
Definition: pathfinding.hpp:154
float getXAngleToNext(float x, float y, float z) const
Definition: pathfinding.cpp:270
const float PATHFIND_Z_REACH
Definition: pathfinding.hpp:24