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.
This commit is contained in:
Lioncash 2024-01-31 12:20:11 -05:00
parent 81aca79145
commit ccacda5e2c
1 changed files with 4 additions and 8 deletions

View File

@ -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<std::string> graphics_mod_user_directories =