diff --git a/modules/navigation/3d/nav_mesh_queries_3d.cpp b/modules/navigation/3d/nav_mesh_queries_3d.cpp index 70207f86ced..5acc598d431 100644 --- a/modules/navigation/3d/nav_mesh_queries_3d.cpp +++ b/modules/navigation/3d/nav_mesh_queries_3d.cpp @@ -234,7 +234,7 @@ Vector NavMeshQueries3D::polygons_get_path(const LocalVectoredges) { // Iterate over connections in this edge, then compute the new optimized travel distance assigned to this polygon. - for (int connection_index = 0; connection_index < edge.connections.size(); connection_index++) { + for (uint32_t connection_index = 0; connection_index < edge.connections.size(); connection_index++) { const gd::Edge::Connection &connection = edge.connections[connection_index]; // Only consider the connection to another polygon if this polygon is in a region with compatible layers. diff --git a/modules/navigation/nav_map.cpp b/modules/navigation/nav_map.cpp index 04c8a5a9437..8055dd4bc8d 100644 --- a/modules/navigation/nav_map.cpp +++ b/modules/navigation/nav_map.cpp @@ -426,13 +426,8 @@ void NavMap::sync() { _new_pm_polygon_count = polygon_count; - struct ConnectionPair { - gd::Edge::Connection connections[2]; - int size = 0; - }; - // Group all edges per key. - HashMap connection_pairs_map; + connection_pairs_map.clear(); connection_pairs_map.reserve(polygons.size()); int free_edges_count = 0; // How many ConnectionPairs have only one Connection. @@ -469,7 +464,7 @@ void NavMap::sync() { } } - LocalVector free_edges; + free_edges.clear(); free_edges.reserve(free_edges_count); for (const KeyValue &pair_it : connection_pairs_map) { diff --git a/modules/navigation/nav_map.h b/modules/navigation/nav_map.h index b9120c04d9a..3442b784976 100644 --- a/modules/navigation/nav_map.h +++ b/modules/navigation/nav_map.h @@ -128,6 +128,14 @@ class NavMap : public NavRid { HashMap> region_external_connections; + struct ConnectionPair { + gd::Edge::Connection connections[2]; + int size = 0; + }; + + HashMap connection_pairs_map; + LocalVector free_edges; + public: NavMap(); ~NavMap(); diff --git a/modules/navigation/nav_utils.h b/modules/navigation/nav_utils.h index ba4c44b748f..c466c82fc7f 100644 --- a/modules/navigation/nav_utils.h +++ b/modules/navigation/nav_utils.h @@ -94,7 +94,7 @@ struct Edge { }; /// Connections from this edge to other polygons. - Vector connections; + LocalVector connections; }; struct Polygon {