From 77f1f58c0a7eb55001b375f1945690ed5c1e87a2 Mon Sep 17 00:00:00 2001 From: tycho Date: Tue, 19 May 2015 19:32:10 +0100 Subject: Make -Werror disabling file only Ad fix a load of warnings --- src/Mobs/Path.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Mobs/Path.h') diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index 7a4182f17..31002fe7f 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -99,7 +99,7 @@ public: return m_PathPoints[m_PathPoints.size() - 1 - a_index]; } /** Returns the total number of points this path has. */ - inline int GetPointCount() + inline size_t GetPointCount() { if (m_Status != ePathFinderStatus::PATH_FOUND) { -- cgit v1.2.3 From 7021547e99e1e169aff1ff0fada6f7e1e5349bcf Mon Sep 17 00:00:00 2001 From: SafwatHalaby Date: Sat, 23 May 2015 17:41:29 +0300 Subject: Pathfinder - Bounding boxes and some tweaks --- src/Mobs/Path.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Mobs/Path.h') diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index b296bbdf5..3b9c0400e 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -68,8 +68,8 @@ public: @param a_MaxSteps The maximum steps before giving up. */ cPath( cChunk & a_Chunk, - const Vector3i & a_StartingPoint, const Vector3i & a_EndingPoint, int a_MaxSteps, - double a_BoundingBoxWidth = 1, double a_BoundingBoxHeight = 2, + const Vector3d & a_StartingPoint, const Vector3d & a_EndingPoint, int a_MaxSteps, + double a_BoundingBoxWidth, double a_BoundingBoxHeight, int a_MaxUp = 1, int a_MaxDown = 1 ); @@ -89,10 +89,11 @@ public: /* Point retrieval functions, inlined for performance. */ /** Returns the next point in the path. */ - inline Vector3i GetNextPoint() + inline Vector3d GetNextPoint() { ASSERT(m_Status == ePathFinderStatus::PATH_FOUND); - return m_PathPoints[m_PathPoints.size() - 1 - (++m_CurrentPoint)]; + 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() @@ -106,11 +107,12 @@ public: return (m_CurrentPoint == 0); } /** Get the point at a_index. Remark: Internally, the indexes are reversed. */ - inline Vector3i GetPoint(size_t a_index) + inline Vector3d GetPoint(size_t a_index) { ASSERT(m_Status == ePathFinderStatus::PATH_FOUND); ASSERT(a_index < m_PathPoints.size()); - return m_PathPoints[m_PathPoints.size() - 1 - a_index]; + 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 int GetPointCount() @@ -161,6 +163,9 @@ private: std::unordered_map m_Map; Vector3i m_Destination; Vector3i m_Source; + int m_BoundingBoxWidth; + int m_BoundingBoxHeight; + double m_HalfWidth; int m_StepsLeft; cPathCell * m_NearestPointToTarget; cFastRandom m_Rand; -- cgit v1.2.3 From dae9e5792a4f030ae9e748548a16a89790fbd311 Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 24 May 2015 12:56:56 +0100 Subject: Made -Weverything an error. --- src/Mobs/Path.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Mobs/Path.h') diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index 71b42edc0..db74eaba2 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -128,13 +128,13 @@ public: { // Guaranteed to have no hash collisions for any 128x128x128 area. Suitable for pathfinding. int32_t t = 0; - t += (int8_t)a_Vector.x; + t += static_cast(a_Vector.x); t = t << 8; - t += (int8_t)a_Vector.y; + t += static_cast(a_Vector.y); t = t << 8; - t += (int8_t)a_Vector.z; + t += static_cast(a_Vector.z); t = t << 8; - return (size_t)t; + return static_cast(t); } }; private: -- cgit v1.2.3