summaryrefslogtreecommitdiffstats
path: root/editor/plugins/resource_preloader_editor_plugin.cpp
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-04-15 15:18:34 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-05-04 16:08:55 +0200
commit955d5affa857ec1f358c56da8fb1ff4ab6590704 (patch)
treeb667ac9f6f62bff17ce032683c0eb09727660555 /editor/plugins/resource_preloader_editor_plugin.cpp
parent7ebc866418b075df58cbe4e31fcf8b0c3acd70a1 (diff)
downloadredot-engine-955d5affa857ec1f358c56da8fb1ff4ab6590704.tar.gz
Reduce and prevent unnecessary random-access to `List`
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element) * Removed subscript operator, in favor of a more explicit `get` * Added conversion from `Iterator` to `ConstIterator` * Remade existing operations into other solutions when applicable
Diffstat (limited to 'editor/plugins/resource_preloader_editor_plugin.cpp')
-rw-r--r--editor/plugins/resource_preloader_editor_plugin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp
index 2e0a9c7272..c95195ae2a 100644
--- a/editor/plugins/resource_preloader_editor_plugin.cpp
+++ b/editor/plugins/resource_preloader_editor_plugin.cpp
@@ -90,8 +90,8 @@ void ResourcePreloaderEditor::_load_pressed() {
file->clear_filters();
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("", &extensions);
- for (int i = 0; i < extensions.size(); i++) {
- file->add_filter("*." + extensions[i]);
+ for (const String &extension : extensions) {
+ file->add_filter("*." + extension);
}
file->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILES);