From 171c59a01b07b7513cf7a281bbcb141e8182d274 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Tue, 2 Jun 2015 13:29:52 +0100 Subject: Changed appropriate containers to unordered_map Thanks to @worktycho for guidance! * Potential speed improvements --- src/Mobs/Path.h | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/Mobs') diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index c250eece2..491165795 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -124,21 +124,6 @@ public: return m_PathPoints.size(); } - struct VectorHasher - { - std::size_t operator()(const Vector3i & a_Vector) const - { - // Guaranteed to have no hash collisions for any 128x128x128 area. Suitable for pathfinding. - int32_t t = 0; - t += static_cast(a_Vector.x); - t = t << 8; - t += static_cast(a_Vector.y); - t = t << 8; - t += static_cast(a_Vector.z); - t = t << 8; - return static_cast(t); - } - }; private: /* General */ @@ -160,7 +145,7 @@ private: /* Pathfinding fields */ std::priority_queue, compareHeuristics> m_OpenList; - std::unordered_map m_Map; + std::unordered_map m_Map; Vector3i m_Destination; Vector3i m_Source; int m_BoundingBoxWidth; -- cgit v1.2.3