diff options
author | Mattes D <github@xoft.cz> | 2015-07-31 16:49:10 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-07-31 16:49:10 +0200 |
commit | 6e4122e551eeb41d3e950b363dd837d5586fe560 (patch) | |
tree | b5ee221d8a8e63c7d3b7868da1db19bf717a6ffd /src/Mobs/Path.h | |
parent | Merge pull request #2400 from cuberite/OffloadBadChunks (diff) | |
download | cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.gz cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.bz2 cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.lz cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.xz cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.tar.zst cuberite-6e4122e551eeb41d3e950b363dd837d5586fe560.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Path.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index d4ad066e3..04841f2b4 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -79,7 +79,7 @@ public: /** Performs part of the path calculation and returns the appropriate status. If NEARBY_FOUND is returned, it means that the destination is not reachable, but a nearby destination is reachable. If the user likes the alternative destination, they can call AcceptNearbyPath to treat the path as found, - and to make consequent calls to step return PATH_FOUND*/ + and to make consequent calls to step return PATH_FOUND */ ePathFinderStatus Step(cChunk & a_Chunk); /** Called after the PathFinder's step returns NEARBY_FOUND. @@ -87,7 +87,8 @@ public: the PathFinder found a path to. */ Vector3i AcceptNearbyPath(); - /* Point retrieval functions, inlined for performance. */ + // Point retrieval functions, inlined for performance: + /** Returns the next point in the path. */ inline Vector3d GetNextPoint() { @@ -95,17 +96,23 @@ public: Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - (++m_CurrentPoint)]; return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth); } + + /** Checks whether this is the last point or not. Never call getnextPoint when this is true. */ inline bool IsLastPoint() { ASSERT(m_Status == ePathFinderStatus::PATH_FOUND); return (m_CurrentPoint == m_PathPoints.size() - 1); } + + inline bool IsFirstPoint() { ASSERT(m_Status == ePathFinderStatus::PATH_FOUND); return (m_CurrentPoint == 0); } + + /** Get the point at a_index. Remark: Internally, the indexes are reversed. */ inline Vector3d GetPoint(size_t a_index) { @@ -114,6 +121,8 @@ public: Vector3i Point = m_PathPoints[m_PathPoints.size() - 1 - a_index]; return Vector3d(Point.x + m_HalfWidth, Point.y, Point.z + m_HalfWidth); } + + /** Returns the total number of points this path has. */ inline size_t GetPointCount() { |