You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
This commit is contained in:
@@ -1608,7 +1608,7 @@ void VisualScriptEditor::_remove_output_port(int p_id, int p_port) {
|
||||
if (E.from_node == p_id && E.from_port == p_port) {
|
||||
// Push into the connections map.
|
||||
if (!conn_map.has(E.to_node)) {
|
||||
conn_map.set(E.to_node, Set<int>());
|
||||
conn_map.insert(E.to_node, Set<int>());
|
||||
}
|
||||
conn_map[E.to_node].insert(E.to_port);
|
||||
}
|
||||
@@ -1617,11 +1617,9 @@ void VisualScriptEditor::_remove_output_port(int p_id, int p_port) {
|
||||
undo_redo->add_do_method(vsn.ptr(), "remove_output_data_port", p_port);
|
||||
undo_redo->add_do_method(this, "_update_graph", p_id);
|
||||
|
||||
List<int> keys;
|
||||
conn_map.get_key_list(&keys);
|
||||
for (const int &E : keys) {
|
||||
for (const Set<int>::Element *F = conn_map[E].front(); F; F = F->next()) {
|
||||
undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E, F->get());
|
||||
for (const KeyValue<int, Set<int>> &E : conn_map) {
|
||||
for (const Set<int>::Element *F = E.value.front(); F; F = F->next()) {
|
||||
undo_redo->add_undo_method(script.ptr(), "data_connect", p_id, p_port, E.key, F->get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1912,7 +1910,7 @@ void VisualScriptEditor::_on_nodes_duplicate() {
|
||||
Ref<VisualScriptNode> dupe = node->duplicate(true);
|
||||
|
||||
int new_id = idc++;
|
||||
remap.set(F->get(), new_id);
|
||||
remap.insert(F->get(), new_id);
|
||||
|
||||
to_select.insert(new_id);
|
||||
undo_redo->add_do_method(script.ptr(), "add_node", new_id, dupe, script->get_node_position(F->get()) + Vector2(20, 20));
|
||||
|
||||
Reference in New Issue
Block a user