diff options
Diffstat (limited to 'modules/navigation/nav_utils.h')
-rw-r--r-- | modules/navigation/nav_utils.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/navigation/nav_utils.h b/modules/navigation/nav_utils.h index 5b6c695ca4..a9f4e0e2fc 100644 --- a/modules/navigation/nav_utils.h +++ b/modules/navigation/nav_utils.h @@ -32,8 +32,9 @@ #define NAV_UTILS_H #include "core/math/vector3.h" +#include "core/templates/hash_map.h" +#include "core/templates/hashfuncs.h" #include "core/templates/vector.h" - #include <vector> class NavRegion; @@ -49,15 +50,18 @@ union PointKey { }; uint64_t key = 0; - bool operator<(const PointKey &p_key) const { return key < p_key.key; } }; struct EdgeKey { PointKey a; PointKey b; - bool operator<(const EdgeKey &p_key) const { - return (a.key == p_key.a.key) ? (b.key < p_key.b.key) : (a.key < p_key.a.key); + static uint32_t hash(const EdgeKey &p_val) { + return hash_one_uint64(p_val.a.key) ^ hash_one_uint64(p_val.b.key); + } + + bool operator==(const EdgeKey &p_key) const { + return (a.key == p_key.a.key) && (b.key == p_key.b.key); } EdgeKey(const PointKey &p_a = PointKey(), const PointKey &p_b = PointKey()) : |