From ccacda5e2c4aed03ea75ef17d8f73376464a7b00 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 31 Jan 2024 12:20:11 -0500 Subject: [PATCH] GraphicsModGroup: Simplify try_add_mod() We can use contains() here, and also move the mod config if it's valid instead of copying it, since it contains quite a bit of allocated data. --- .../GraphicsModSystem/Config/GraphicsModGroup.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp index 2e8459dfe4..f200604503 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.cpp @@ -95,15 +95,11 @@ void GraphicsModGroupConfig::Load() GraphicsModConfig::Source source) { auto file = dir + DIR_SEP + "metadata.json"; UnifyPathSeparators(file); - if (known_paths.find(file) != known_paths.end()) - { + if (known_paths.contains(file)) return; - } - const auto mod = GraphicsModConfig::Create(file, source); - if (mod) - { - m_graphics_mods.push_back(*mod); - } + + if (auto mod = GraphicsModConfig::Create(file, source)) + m_graphics_mods.push_back(std::move(*mod)); }; const std::set graphics_mod_user_directories =