From a0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576 Mon Sep 17 00:00:00 2001 From: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Date: Mon, 6 May 2024 16:20:20 +0200 Subject: Replace `find` with `contains/has` where applicable * Replaces `find(...) != -1` with `contains` for `String` * Replaces `find(...) == -1` with `!contains` for `String` * Replaces `find(...) != -1` with `has` for containers * Replaces `find(...) == -1` with `!has` for containers --- editor/filesystem_dock.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'editor/filesystem_dock.cpp') diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index ef77e5340b..4c7c723dd5 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -261,7 +261,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory if (p_unfold_path && current_path.begins_with(lpath) && current_path != lpath) { subdirectory_item->set_collapsed(false); } else { - subdirectory_item->set_collapsed(uncollapsed_paths.find(lpath) < 0); + subdirectory_item->set_collapsed(!uncollapsed_paths.has(lpath)); } if (!searched_tokens.is_empty() && _matches_all_search_tokens(dname)) { parent_should_expand = true; @@ -407,7 +407,7 @@ void FileSystemDock::_update_tree(const Vector &p_uncollapsed_paths, boo favorites_item->set_icon(0, get_editor_theme_icon(SNAME("Favorites"))); favorites_item->set_text(0, TTR("Favorites:")); favorites_item->set_metadata(0, "Favorites"); - favorites_item->set_collapsed(p_uncollapsed_paths.find("Favorites") < 0); + favorites_item->set_collapsed(!p_uncollapsed_paths.has("Favorites")); Vector favorite_paths = EditorSettings::get_singleton()->get_favorites(); @@ -2300,7 +2300,7 @@ void FileSystemDock::_file_option(int p_option, const Vector &p_selected TreeItem *selected = tree->get_root(); selected = tree->get_next_selected(selected); while (selected) { - if (p_selected.find(selected->get_metadata(0)) >= 0) { + if (p_selected.has(selected->get_metadata(0))) { selected->set_collapsed(false); } selected = tree->get_next_selected(selected); -- cgit v1.2.3