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 | |
parent | e4dfa69bcf58e4d50acdde32c590364e43fce3ab (diff) |
Use range iterators for `Map`
Diffstat (limited to 'core')
-rw-r--r-- | core/config/project_settings.cpp | 36 | ||||
-rw-r--r-- | core/core_bind.cpp | 8 | ||||
-rw-r--r-- | core/debugger/engine_debugger.cpp | 10 | ||||
-rw-r--r-- | core/debugger/local_debugger.cpp | 8 | ||||
-rw-r--r-- | core/debugger/remote_debugger.cpp | 4 | ||||
-rw-r--r-- | core/extension/extension_api_dump.cpp | 6 | ||||
-rw-r--r-- | core/extension/native_extension_manager.cpp | 12 | ||||
-rw-r--r-- | core/input/input.cpp | 14 | ||||
-rw-r--r-- | core/io/file_access_pack.cpp | 8 | ||||
-rw-r--r-- | core/io/ip.cpp | 8 | ||||
-rw-r--r-- | core/io/resource.cpp | 4 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 4 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 4 | ||||
-rw-r--r-- | core/math/quick_hull.cpp | 24 | ||||
-rw-r--r-- | core/math/triangle_mesh.cpp | 4 | ||||
-rw-r--r-- | core/object/message_queue.cpp | 12 | ||||
-rw-r--r-- | core/object/script_language.cpp | 4 | ||||
-rw-r--r-- | core/string/optimized_translation.cpp | 10 | ||||
-rw-r--r-- | core/string/translation.cpp | 12 | ||||
-rw-r--r-- | core/variant/variant_call.cpp | 8 |
20 files changed, 100 insertions, 100 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); } diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 1f028702f6..0b9816932c 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -2411,12 +2411,12 @@ Error EngineDebugger::call_capture(void *p_user, const String &p_cmd, const Arra } EngineDebugger::~EngineDebugger() { - for (Map<StringName, Callable>::Element *E = captures.front(); E; E = E->next()) { - ::EngineDebugger::unregister_message_capture(E->key()); + for (const KeyValue<StringName, Callable> &E : captures) { + ::EngineDebugger::unregister_message_capture(E.key); } captures.clear(); - for (Map<StringName, ProfilerCallable>::Element *E = profilers.front(); E; E = E->next()) { - ::EngineDebugger::unregister_profiler(E->key()); + for (const KeyValue<StringName, ProfilerCallable> &E : profilers) { + ::EngineDebugger::unregister_profiler(E.key); } profilers.clear(); } diff --git a/core/debugger/engine_debugger.cpp b/core/debugger/engine_debugger.cpp index a522b1310f..059025aa8f 100644 --- a/core/debugger/engine_debugger.cpp +++ b/core/debugger/engine_debugger.cpp @@ -123,8 +123,8 @@ void EngineDebugger::iteration(uint64_t p_frame_ticks, uint64_t p_process_ticks, physics_time = USEC_TO_SEC(p_physics_ticks); physics_frame_time = p_physics_frame_time; // Notify tick to running profilers - for (Map<StringName, Profiler>::Element *E = profilers.front(); E; E = E->next()) { - Profiler &p = E->get(); + for (KeyValue<StringName, Profiler> &E : profilers) { + Profiler &p = E.value; if (!p.active || !p.tick) { continue; } @@ -179,9 +179,9 @@ void EngineDebugger::initialize(const String &p_uri, bool p_skip_breakpoints, Ve void EngineDebugger::deinitialize() { if (singleton) { // Stop all profilers - for (Map<StringName, Profiler>::Element *E = profilers.front(); E; E = E->next()) { - if (E->get().active) { - singleton->profiler_enable(E->key(), false); + for (const KeyValue<StringName, Profiler> &E : profilers) { + if (E.value.active) { + singleton->profiler_enable(E.key, false); } } diff --git a/core/debugger/local_debugger.cpp b/core/debugger/local_debugger.cpp index b0b3f11424..f7e56351b0 100644 --- a/core/debugger/local_debugger.cpp +++ b/core/debugger/local_debugger.cpp @@ -166,8 +166,8 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { } else if (line.begins_with("set")) { if (line.get_slice_count(" ") == 1) { - for (Map<String, String>::Element *E = options.front(); E; E = E->next()) { - print_line("\t" + E->key() + "=" + E->value()); + for (const KeyValue<String, String> &E : options) { + print_line("\t" + E.key + "=" + E.value); } } else { @@ -249,8 +249,8 @@ void LocalDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { } print_line("Breakpoint(s): " + itos(breakpoints.size())); - for (Map<int, Set<StringName>>::Element *E = breakpoints.front(); E; E = E->next()) { - print_line("\t" + String(E->value().front()->get()) + ":" + itos(E->key())); + for (const KeyValue<int, Set<StringName>> &E : breakpoints) { + print_line("\t" + String(E.value.front()->get()) + ":" + itos(E.key)); } } else { diff --git a/core/debugger/remote_debugger.cpp b/core/debugger/remote_debugger.cpp index f865dfe102..032c7d55c0 100644 --- a/core/debugger/remote_debugger.cpp +++ b/core/debugger/remote_debugger.cpp @@ -179,8 +179,8 @@ public: if (pt - last_profile_time > 100) { last_profile_time = pt; DebuggerMarshalls::NetworkProfilerFrame frame; - for (Map<ObjectID, NodeInfo>::Element *E = multiplayer_node_data.front(); E; E = E->next()) { - frame.infos.push_back(E->get()); + for (const KeyValue<ObjectID, NodeInfo> &E : multiplayer_node_data) { + frame.infos.push_back(E.value); } multiplayer_node_data.clear(); EngineDebugger::get_singleton()->send_message("network:profile_frame", frame.serialize()); diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp index a8547a0090..3856229eac 100644 --- a/core/extension/extension_api_dump.cpp +++ b/core/extension/extension_api_dump.cpp @@ -353,11 +353,11 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { api_dump["global_constants"] = constants; Array enums; - for (Map<String, List<Pair<String, int>>>::Element *E = enum_list.front(); E; E = E->next()) { + for (const KeyValue<String, List<Pair<String, int>>> &E : enum_list) { Dictionary d1; - d1["name"] = E->key(); + d1["name"] = E.key; Array values; - for (const Pair<String, int> &F : E->get()) { + for (const Pair<String, int> &F : E.value) { Dictionary d2; d2["name"] = F.first; d2["value"] = F.second; diff --git a/core/extension/native_extension_manager.cpp b/core/extension/native_extension_manager.cpp index 8b7a9df4f1..4eac5249c9 100644 --- a/core/extension/native_extension_manager.cpp +++ b/core/extension/native_extension_manager.cpp @@ -84,8 +84,8 @@ bool NativeExtensionManager::is_extension_loaded(const String &p_path) const { Vector<String> NativeExtensionManager::get_loaded_extensions() const { Vector<String> ret; - for (const Map<String, Ref<NativeExtension>>::Element *E = native_extension_map.front(); E; E = E->next()) { - ret.push_back(E->key()); + for (const KeyValue<String, Ref<NativeExtension>> &E : native_extension_map) { + ret.push_back(E.key); } return ret; } @@ -97,16 +97,16 @@ Ref<NativeExtension> NativeExtensionManager::get_extension(const String &p_path) void NativeExtensionManager::initialize_extensions(NativeExtension::InitializationLevel p_level) { ERR_FAIL_COND(int32_t(p_level) - 1 != level); - for (Map<String, Ref<NativeExtension>>::Element *E = native_extension_map.front(); E; E = E->next()) { - E->get()->initialize_library(p_level); + for (KeyValue<String, Ref<NativeExtension>> &E : native_extension_map) { + E.value->initialize_library(p_level); } level = p_level; } void NativeExtensionManager::deinitialize_extensions(NativeExtension::InitializationLevel p_level) { ERR_FAIL_COND(int32_t(p_level) != level); - for (Map<String, Ref<NativeExtension>>::Element *E = native_extension_map.front(); E; E = E->next()) { - E->get()->deinitialize_library(p_level); + for (KeyValue<String, Ref<NativeExtension>> &E : native_extension_map) { + E.value->deinitialize_library(p_level); } level = int32_t(p_level) - 1; } diff --git a/core/input/input.cpp b/core/input/input.cpp index 9195f7d8b5..05b02408a1 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -863,9 +863,9 @@ void Input::release_pressed_events() { joy_buttons_pressed.clear(); _joy_axis.clear(); - for (Map<StringName, Input::Action>::Element *E = action_state.front(); E; E = E->next()) { - if (E->get().pressed) { - action_release(E->key()); + for (const KeyValue<StringName, Input::Action> &E : action_state) { + if (E.value.pressed) { + action_release(E.key); } } } @@ -1322,8 +1322,8 @@ void Input::add_joy_mapping(String p_mapping, bool p_update_existing) { if (p_update_existing) { Vector<String> entry = p_mapping.split(","); String uid = entry[0]; - for (Map<int, Joypad>::Element *E = joy_names.front(); E; E = E->next()) { - Joypad &joy = E->get(); + for (KeyValue<int, Joypad> &E : joy_names) { + Joypad &joy = E.value; if (joy.uid == uid) { joy.mapping = map_db.size() - 1; } @@ -1337,8 +1337,8 @@ void Input::remove_joy_mapping(String p_guid) { map_db.remove(i); } } - for (Map<int, Joypad>::Element *E = joy_names.front(); E; E = E->next()) { - Joypad &joy = E->get(); + for (KeyValue<int, Joypad> &E : joy_names) { + Joypad &joy = E.value; if (joy.uid == p_guid) { joy.mapping = -1; } diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 7b43daf9c0..b2832b2a75 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -110,8 +110,8 @@ PackedData::PackedData() { } void PackedData::_free_packed_dirs(PackedDir *p_dir) { - for (Map<String, PackedDir *>::Element *E = p_dir->subdirs.front(); E; E = E->next()) { - _free_packed_dirs(E->get()); + for (const KeyValue<String, PackedDir *> &E : p_dir->subdirs) { + _free_packed_dirs(E.value); } memdelete(p_dir); } @@ -395,8 +395,8 @@ Error DirAccessPack::list_dir_begin() { list_dirs.clear(); list_files.clear(); - for (Map<String, PackedData::PackedDir *>::Element *E = current->subdirs.front(); E; E = E->next()) { - list_dirs.push_back(E->key()); + for (const KeyValue<String, PackedData::PackedDir *> &E : current->subdirs) { + list_dirs.push_back(E.key); } for (Set<String>::Element *E = current->files.front(); E; E = E->next()) { diff --git a/core/io/ip.cpp b/core/io/ip.cpp index e3102508a3..68b4e4b354 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -288,8 +288,8 @@ Array IP::_get_local_interfaces() const { Array results; Map<String, Interface_Info> interfaces; get_local_interfaces(&interfaces); - for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) { - Interface_Info &c = E->get(); + for (KeyValue<String, Interface_Info> &E : interfaces) { + Interface_Info &c = E.value; Dictionary rc; rc["name"] = c.name; rc["friendly"] = c.name_friendly; @@ -310,8 +310,8 @@ Array IP::_get_local_interfaces() const { void IP::get_local_addresses(List<IPAddress> *r_addresses) const { Map<String, Interface_Info> interfaces; get_local_interfaces(&interfaces); - for (Map<String, Interface_Info>::Element *E = interfaces.front(); E; E = E->next()) { - for (const IPAddress &F : E->get().ip_addresses) { + for (const KeyValue<String, Interface_Info> &E : interfaces) { + for (const IPAddress &F : E.value.ip_addresses) { r_addresses->push_front(F); } } diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 87b4d7195d..1cefa52d69 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -540,9 +540,9 @@ void ResourceCache::dump(const char *p_file, bool p_short) { } } - for (Map<String, int>::Element *E = type_count.front(); E; E = E->next()) { + for (const KeyValue<String, int> &E : type_count) { if (f) { - f->store_line(E->key() + " count: " + itos(E->get())); + f->store_line(E.key + " count: " + itos(E.value)); } } if (f) { diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 84fd6496a7..cbb033f6c6 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1960,8 +1960,8 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const RES &p Vector<RES> save_order; save_order.resize(external_resources.size()); - for (Map<RES, int>::Element *E = external_resources.front(); E; E = E->next()) { - save_order.write[E->get()] = E->key(); + for (const KeyValue<RES, int> &E : external_resources) { + save_order.write[E.value] = E.key; } for (int i = 0; i < save_order.size(); i++) { diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 3026236f07..2198761c2a 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -156,8 +156,8 @@ void ResourceFormatLoader::get_dependencies(const String &p_path, List<String> * Error ResourceFormatLoader::rename_dependencies(const String &p_path, const Map<String, String> &p_map) { Dictionary deps_dict; - for (Map<String, String>::Element *E = p_map.front(); E; E = E->next()) { - deps_dict[E->key()] = E->value(); + for (KeyValue<String, String> E : p_map) { + deps_dict[E.key] = E.value; } int64_t err; diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index 0960fe19a6..d438a9a377 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -265,8 +265,8 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_ //create new faces from horizon edges List<List<Face>::Element *> new_faces; //new faces - for (Map<Edge, FaceConnect>::Element *E = lit_edges.front(); E; E = E->next()) { - FaceConnect &fc = E->get(); + for (KeyValue<Edge, FaceConnect> &E : lit_edges) { + FaceConnect &fc = E.value; if (fc.left && fc.right) { continue; //edge is uninteresting, not on horizon } @@ -275,8 +275,8 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_ Face face; face.vertices[0] = f.points_over[next]; - face.vertices[1] = E->key().vertices[0]; - face.vertices[2] = E->key().vertices[1]; + face.vertices[1] = E.key.vertices[0]; + face.vertices[2] = E.key.vertices[1]; Plane p(p_points[face.vertices[0]], p_points[face.vertices[1]], p_points[face.vertices[2]]); @@ -418,13 +418,13 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_ } // remove all edge connections to this face - for (Map<Edge, RetFaceConnect>::Element *G = ret_edges.front(); G; G = G->next()) { - if (G->get().left == O) { - G->get().left = nullptr; + for (KeyValue<Edge, RetFaceConnect> &G : ret_edges) { + if (G.value.left == O) { + G.value.left = nullptr; } - if (G->get().right == O) { - G->get().right = nullptr; + if (G.value.right == O) { + G.value.right = nullptr; } } @@ -444,10 +444,10 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_ } r_mesh.edges.resize(ret_edges.size()); idx = 0; - for (Map<Edge, RetFaceConnect>::Element *E = ret_edges.front(); E; E = E->next()) { + for (const KeyValue<Edge, RetFaceConnect> &E : ret_edges) { Geometry3D::MeshData::Edge e; - e.a = E->key().vertices[0]; - e.b = E->key().vertices[1]; + e.a = E.key.vertices[0]; + e.b = E.key.vertices[1]; r_mesh.edges.write[idx++] = e; } diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp index 16d9652ef2..2f3da0b6a8 100644 --- a/core/math/triangle_mesh.cpp +++ b/core/math/triangle_mesh.cpp @@ -157,8 +157,8 @@ void TriangleMesh::create(const Vector<Vector3> &p_faces) { vertices.resize(db.size()); Vector3 *vw = vertices.ptrw(); - for (Map<Vector3, int>::Element *E = db.front(); E; E = E->next()) { - vw[E->get()] = E->key(); + for (const KeyValue<Vector3, int> &E : db) { + vw[E.value] = E.key; } } diff --git a/core/object/message_queue.cpp b/core/object/message_queue.cpp index 4751c69f1e..736e940846 100644 --- a/core/object/message_queue.cpp +++ b/core/object/message_queue.cpp @@ -227,16 +227,16 @@ void MessageQueue::statistics() { print_line("TOTAL BYTES: " + itos(buffer_end)); print_line("NULL count: " + itos(null_count)); - for (Map<StringName, int>::Element *E = set_count.front(); E; E = E->next()) { - print_line("SET " + E->key() + ": " + itos(E->get())); + for (const KeyValue<StringName, int> &E : set_count) { + print_line("SET " + E.key + ": " + itos(E.value)); } - for (Map<Callable, int>::Element *E = call_count.front(); E; E = E->next()) { - print_line("CALL " + E->key() + ": " + itos(E->get())); + for (const KeyValue<Callable, int> &E : call_count) { + print_line("CALL " + E.key + ": " + itos(E.value)); } - for (Map<int, int>::Element *E = notify_count.front(); E; E = E->next()) { - print_line("NOTIFY " + itos(E->key()) + ": " + itos(E->get())); + for (const KeyValue<int, int> &E : notify_count) { + print_line("NOTIFY " + itos(E.key) + ": " + itos(E.value)); } } diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 0fb8c7350c..b0ce46ca2b 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -93,8 +93,8 @@ Dictionary Script::_get_script_constant_map() { Dictionary ret; Map<StringName, Variant> map; get_constants(&map); - for (Map<StringName, Variant>::Element *E = map.front(); E; E = E->next()) { - ret[E->key()] = E->value(); + for (const KeyValue<StringName, Variant> &E : map) { + ret[E.key] = E.value; } return ret; } diff --git a/core/string/optimized_translation.cpp b/core/string/optimized_translation.cpp index 5863bd1c46..839b7a9c01 100644 --- a/core/string/optimized_translation.cpp +++ b/core/string/optimized_translation.cpp @@ -162,11 +162,11 @@ void OptimizedTranslation::generate(const Ref<Translation> &p_from) { btw[btindex++] = t.size(); btw[btindex++] = hfunc_table[i]; - for (Map<uint32_t, int>::Element *E = t.front(); E; E = E->next()) { - btw[btindex++] = E->key(); - btw[btindex++] = compressed[E->get()].offset; - btw[btindex++] = compressed[E->get()].compressed.size(); - btw[btindex++] = compressed[E->get()].orig_len; + for (const KeyValue<uint32_t, int> &E : t) { + btw[btindex++] = E.key; + btw[btindex++] = compressed[E.value].offset; + btw[btindex++] = compressed[E.value].compressed.size(); + btw[btindex++] = compressed[E.value].orig_len; } } diff --git a/core/string/translation.cpp b/core/string/translation.cpp index 5c0eb388f5..5e3b8297aa 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -820,8 +820,8 @@ static const char *locale_renames[][2] = { Dictionary Translation::_get_messages() const { Dictionary d; - for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) { - d[E->key()] = E->value(); + for (const KeyValue<StringName, StringName> &E : translation_map) { + d[E.key] = E.value; } return d; } @@ -830,8 +830,8 @@ Vector<String> Translation::_get_message_list() const { Vector<String> msgs; msgs.resize(translation_map.size()); int idx = 0; - for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) { - msgs.set(idx, E->key()); + for (const KeyValue<StringName, StringName> &E : translation_map) { + msgs.set(idx, E.key); idx += 1; } @@ -911,8 +911,8 @@ void Translation::erase_message(const StringName &p_src_text, const StringName & } void Translation::get_message_list(List<StringName> *r_messages) const { - for (const Map<StringName, StringName>::Element *E = translation_map.front(); E; E = E->next()) { - r_messages->push_back(E->key()); + for (const KeyValue<StringName, StringName> &E : translation_map) { + r_messages->push_back(E.key); } } diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 32d6778a2b..5682a7c7b5 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1241,8 +1241,8 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c for (List<StringName>::Element *E = cd.value_ordered.front(); E; E = E->next()) { p_constants->push_back(E->get()); #else - for (Map<StringName, int>::Element *E = cd.value.front(); E; E = E->next()) { - p_constants->push_back(E->key()); + for (const KeyValue<StringName, int> &E : cd.value) { + p_constants->push_back(E.key); #endif } @@ -1250,8 +1250,8 @@ void Variant::get_constants_for_type(Variant::Type p_type, List<StringName> *p_c for (List<StringName>::Element *E = cd.variant_value_ordered.front(); E; E = E->next()) { p_constants->push_back(E->get()); #else - for (Map<StringName, Variant>::Element *E = cd.variant_value.front(); E; E = E->next()) { - p_constants->push_back(E->key()); + for (const KeyValue<StringName, Variant> &E : cd.variant_value) { + p_constants->push_back(E.key); #endif } } |