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:
reduz 2022-05-13 15:04:37 +02:00 committed by Rémi Verschelde
parent 396def9b66
commit 746dddc067
587 changed files with 3707 additions and 3538 deletions

View file

@ -557,8 +557,8 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
updating = true;
Set<String> paths;
HashMap<String, Set<String>> types;
RBSet<String> paths;
HashMap<String, RBSet<String>> types;
{
List<StringName> animations;
player->get_animation_list(&animations);
@ -595,9 +595,9 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
filters->clear();
TreeItem *root = filters->create_item();
Map<String, TreeItem *> parenthood;
HashMap<String, TreeItem *> parenthood;
for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
for (RBSet<String>::Element *E = paths.front(); E; E = E->next()) {
NodePath path = E->get();
TreeItem *ti = nullptr;
String accum;
@ -692,7 +692,7 @@ bool AnimationNodeBlendTreeEditor::_update_filters(const Ref<AnimationNode> &ano
//just a node, not a property track
String types_text = "[";
if (types.has(path)) {
Set<String>::Element *F = types[path].front();
RBSet<String>::Element *F = types[path].front();
types_text += F->get();
while (F->next()) {
F = F->next();
@ -903,8 +903,8 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
}
//update animations
for (Map<StringName, ProgressBar *>::Element *E = animations.front(); E; E = E->next()) {
if (E->key() == prev_name) {
for (const KeyValue<StringName, ProgressBar *> &E : animations) {
if (E.key == prev_name) {
animations[new_name] = animations[prev_name];
animations.erase(prev_name);
break;