diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-08-27 00:13:13 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-08-27 00:13:13 +0200 |
commit | 3b8dc45dc3418359b05ec54b90c94aa2b94405c8 (patch) | |
tree | e2e4cb1200d8da5ada4f4d60a7703971ae81c7d3 /src/Mobs/Path.h | |
parent | Small fix for cEvent (diff) | |
parent | Fixed a position bug in the pathfinder (diff) | |
download | cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.tar cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.tar.gz cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.tar.bz2 cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.tar.lz cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.tar.xz cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.tar.zst cuberite-3b8dc45dc3418359b05ec54b90c94aa2b94405c8.zip |
Diffstat (limited to 'src/Mobs/Path.h')
-rw-r--r-- | src/Mobs/Path.h | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index 04841f2b4..d42bb77bc 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -72,10 +72,7 @@ public: double a_BoundingBoxWidth, double a_BoundingBoxHeight, int a_MaxUp = 1, int a_MaxDown = 1 ); - - /** Destroys the path and frees its memory. */ - ~cPath(); - + /** 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, @@ -99,45 +96,27 @@ public: /** Checks whether this is the last point or not. Never call getnextPoint when this is true. */ - inline bool IsLastPoint() + inline bool IsLastPoint() const { ASSERT(m_Status == ePathFinderStatus::PATH_FOUND); return (m_CurrentPoint == m_PathPoints.size() - 1); } - - inline bool IsFirstPoint() + inline bool IsFirstPoint() const { 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) - { - ASSERT(m_Status == ePathFinderStatus::PATH_FOUND); - ASSERT(a_index < m_PathPoints.size()); - 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() - { - if (m_Status != ePathFinderStatus::PATH_FOUND) - { - return 0; - } - return m_PathPoints.size(); - } private: /* General */ bool IsSolid(const Vector3i & a_Location); // Query our hosting world and ask it if there's a solid at a_location. - bool Step_Internal(); // The public version just calls this version * CALCULATIONS_PER_CALL times. + bool StepOnce(); // The public version just calls this version * CALCULATIONS_PER_CALL times. void FinishCalculation(); // Clears the memory used for calculating the path. void FinishCalculation(ePathFinderStatus a_NewStatus); // Clears the memory used for calculating the path and changes the status. void AttemptToFindAlternative(); |