summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Path.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-07-11 21:40:03 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-08-22 18:06:08 +0200
commitbaf3a0780489590d9433d115ee51c02a2ecf3e57 (patch)
treee0ef74726a9f37462fa941c38cfea0aa550b19fe /src/Mobs/Path.h
parentCast UINT to WORD to appease warning (diff)
downloadcuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar
cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.gz
cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.bz2
cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.lz
cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.xz
cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.zst
cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.zip
Diffstat (limited to 'src/Mobs/Path.h')
-rw-r--r--src/Mobs/Path.h29
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();