OpenMW
apps/openmw/mwmechanics/pathfinding.hpp
Go to the documentation of this file.
00001 #ifndef GAME_MWMECHANICS_PATHFINDING_H
00002 #define GAME_MWMECHANICS_PATHFINDING_H
00003 
00004 #include <components/esm/loadpgrd.hpp>
00005 #include <list>
00006 
00007 namespace MWMechanics
00008 {
00009     class PathFinder
00010     {
00011         public:
00012             PathFinder();
00013 
00014             void clearPath();
00015             void buildPath(const ESM::Pathgrid::Point &startPoint, const ESM::Pathgrid::Point &endPoint,
00016                            const ESM::Pathgrid* pathGrid, float xCell = 0, float yCell = 0,
00017                            bool allowShortcuts = true);
00018 
00019             bool checkPathCompleted(float x, float y, float z);
00021             bool checkWaypoint(float x, float y, float z);
00023             float getZAngleToNext(float x, float y) const;
00024 
00025             bool isPathConstructed() const
00026             {
00027                 return mIsPathConstructed;
00028             }
00029 
00030             int getPathSize() const
00031             {
00032                 return mPath.size();
00033             }
00034 
00035             std::list<ESM::Pathgrid::Point> getPath() const
00036             {
00037                 return mPath;
00038             }
00039 
00040         private:
00041             std::list<ESM::Pathgrid::Point> mPath;
00042             bool mIsPathConstructed;
00043     };
00044 }
00045 
00046 #endif