diff options
author | Lightning_A <aaronjrecord@gmail.com> | 2021-08-09 14:13:42 -0600 |
---|---|---|
committer | Lightning_A <aaronjrecord@gmail.com> | 2021-09-30 15:09:12 -0600 |
commit | c63b18507d21b8a213c073bced9057b571cdcd7a (patch) | |
tree | 96b8f7532ae5d923b75bfbac8d6763015b6646bb /core/config | |
parent | e4dfa69bcf58e4d50acdde32c590364e43fce3ab (diff) |
Use range iterators for `Map`
Diffstat (limited to 'core/config')
-rw-r--r-- | core/config/project_settings.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 09f9f84728..85e83ff7f2 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -252,15 +252,15 @@ void ProjectSettings::_get_property_list(List<PropertyInfo> *p_list) const { Set<_VCSort> vclist; - for (Map<StringName, VariantContainer>::Element *E = props.front(); E; E = E->next()) { - const VariantContainer *v = &E->get(); + for (const KeyValue<StringName, VariantContainer> &E : props) { + const VariantContainer *v = &E.value; if (v->hide_from_editor) { continue; } _VCSort vc; - vc.name = E->key(); + vc.name = E.key; vc.order = v->order; vc.type = v->variant.get_type(); if (vc.name.begins_with("input/") || vc.name.begins_with("import/") || vc.name.begins_with("export/") || vc.name.begins_with("/remap") || vc.name.begins_with("/locale") || vc.name.begins_with("/autoload")) { @@ -318,14 +318,14 @@ bool ProjectSettings::_load_resource_pack(const String &p_pack, bool p_replace_f void ProjectSettings::_convert_to_last_version(int p_from_version) { if (p_from_version <= 3) { // Converts the actions from array to dictionary (array of events to dictionary with deadzone + events) - for (Map<StringName, ProjectSettings::VariantContainer>::Element *E = props.front(); E; E = E->next()) { - Variant value = E->get().variant; - if (String(E->key()).begins_with("input/") && value.get_type() == Variant::ARRAY) { + for (KeyValue<StringName, ProjectSettings::VariantContainer> &E : props) { + Variant value = E.value.variant; + if (String(E.key).begins_with("input/") && value.get_type() == Variant::ARRAY) { Array array = value; Dictionary action; action["deadzone"] = Variant(0.5f); action["events"] = array; - E->get().variant = action; + E.value.variant = action; } } } @@ -695,8 +695,8 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str int count = 0; - for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) { - count += E->get().size(); + for (const KeyValue<String, List<String>> &E : props) { + count += E.value.size(); } if (p_custom_features != String()) { @@ -788,7 +788,7 @@ Error ProjectSettings::_save_settings_text(const String &p_file, const Map<Strin } file->store_string("\n"); - for (Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) { + for (const Map<String, List<String>>::Element *E = props.front(); E; E = E->next()) { if (E != props.front()) { file->store_string("\n"); } @@ -831,19 +831,19 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust Set<_VCSort> vclist; if (p_merge_with_current) { - for (Map<StringName, VariantContainer>::Element *G = props.front(); G; G = G->next()) { - const VariantContainer *v = &G->get(); + for (const KeyValue<StringName, VariantContainer> &G : props) { + const VariantContainer *v = &G.value; if (v->hide_from_editor) { continue; } - if (p_custom.has(G->key())) { + if (p_custom.has(G.key)) { continue; } _VCSort vc; - vc.name = G->key(); //*k; + vc.name = G.key; //*k; vc.order = v->order; vc.type = v->variant.get_type(); vc.flags = PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE; @@ -855,14 +855,14 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust } } - for (const Map<String, Variant>::Element *E = p_custom.front(); E; E = E->next()) { + for (const KeyValue<String, Variant> &E : p_custom) { // Lookup global prop to store in the same order - Map<StringName, VariantContainer>::Element *global_prop = props.find(E->key()); + Map<StringName, VariantContainer>::Element *global_prop = props.find(E.key); _VCSort vc; - vc.name = E->key(); + vc.name = E.key; vc.order = global_prop ? global_prop->get().order : 0xFFFFFFF; - vc.type = E->get().get_type(); + vc.type = E.value.get_type(); vc.flags = PROPERTY_USAGE_STORAGE; vclist.insert(vc); } |