mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-05 16:24:39 +00:00
Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
This commit is contained in:
@@ -541,7 +541,7 @@ void NavMap::sync() {
|
||||
}
|
||||
|
||||
// Group all edges per key.
|
||||
Map<gd::EdgeKey, Vector<gd::Edge::Connection>> connections;
|
||||
HashMap<gd::EdgeKey, Vector<gd::Edge::Connection>, gd::EdgeKey> connections;
|
||||
for (size_t poly_id(0); poly_id < polygons.size(); poly_id++) {
|
||||
gd::Polygon &poly(polygons[poly_id]);
|
||||
|
||||
@@ -549,7 +549,7 @@ void NavMap::sync() {
|
||||
int next_point = (p + 1) % poly.points.size();
|
||||
gd::EdgeKey ek(poly.points[p].key, poly.points[next_point].key);
|
||||
|
||||
Map<gd::EdgeKey, Vector<gd::Edge::Connection>>::Element *connection = connections.find(ek);
|
||||
HashMap<gd::EdgeKey, Vector<gd::Edge::Connection>, gd::EdgeKey>::Iterator connection = connections.find(ek);
|
||||
if (!connection) {
|
||||
connections[ek] = Vector<gd::Edge::Connection>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user