1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +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:
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

@@ -34,8 +34,8 @@
#include "core/doc_data.h"
#include "core/io/resource.h"
#include "core/multiplayer/multiplayer.h"
#include "core/templates/map.h"
#include "core/templates/pair.h"
#include "core/templates/rb_map.h"
class ScriptLanguage;
@@ -154,8 +154,8 @@ public:
virtual int get_member_line(const StringName &p_member) const { return -1; }
virtual void get_constants(Map<StringName, Variant> *p_constants) {}
virtual void get_members(Set<StringName> *p_constants) {}
virtual void get_constants(HashMap<StringName, Variant> *p_constants) {}
virtual void get_members(RBSet<StringName> *p_constants) {}
virtual bool is_placeholder_fallback_enabled() const { return false; }
@@ -283,7 +283,7 @@ public:
virtual Ref<Script> make_template(const String &p_template, const String &p_class_name, const String &p_base_class_name) const { return Ref<Script>(); }
virtual Vector<ScriptTemplate> get_built_in_templates(StringName p_object) { return Vector<ScriptTemplate>(); }
virtual bool is_using_templates() { return false; }
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const = 0;
virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptError> *r_errors = nullptr, List<Warning> *r_warnings = nullptr, RBSet<int> *r_safe_lines = nullptr) const = 0;
virtual String validate_path(const String &p_path) const { return ""; }
virtual Script *create_script() const = 0;
virtual bool has_named_classes() const = 0;
@@ -433,8 +433,8 @@ extern uint8_t script_encryption_key[32];
class PlaceHolderScriptInstance : public ScriptInstance {
Object *owner = nullptr;
List<PropertyInfo> properties;
Map<StringName, Variant> values;
Map<StringName, Variant> constants;
HashMap<StringName, Variant> values;
HashMap<StringName, Variant> constants;
ScriptLanguage *language = nullptr;
Ref<Script> script;
@@ -459,7 +459,7 @@ public:
Object *get_owner() override { return owner; }
void update(const List<PropertyInfo> &p_properties, const Map<StringName, Variant> &p_values); //likely changed in editor
void update(const List<PropertyInfo> &p_properties, const HashMap<StringName, Variant> &p_values); //likely changed in editor
virtual bool is_placeholder() const override { return true; }