GraphicsMod: Simplify `std::sort` using ranges and projections
This commit is contained in:
parent
2edf6c6419
commit
8b1975ab18
|
@ -330,8 +330,3 @@ void GraphicsModConfig::DeserializeFromProfile(const picojson::object& obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphicsModConfig::operator<(const GraphicsModConfig& other) const
|
|
||||||
{
|
|
||||||
return m_weight < other.m_weight;
|
|
||||||
}
|
|
||||||
|
|
|
@ -43,6 +43,4 @@ struct GraphicsModConfig
|
||||||
|
|
||||||
void SerializeToProfile(picojson::object* value) const;
|
void SerializeToProfile(picojson::object* value) const;
|
||||||
void DeserializeFromProfile(const picojson::object& value);
|
void DeserializeFromProfile(const picojson::object& value);
|
||||||
|
|
||||||
bool operator<(const GraphicsModConfig& other) const;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -111,7 +111,7 @@ void GraphicsModGroupConfig::Load()
|
||||||
try_add_mod(graphics_mod_directory, GraphicsModConfig::Source::System);
|
try_add_mod(graphics_mod_directory, GraphicsModConfig::Source::System);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(m_graphics_mods.begin(), m_graphics_mods.end());
|
std::ranges::sort(m_graphics_mods, {}, &GraphicsModConfig::m_weight);
|
||||||
for (auto& mod : m_graphics_mods)
|
for (auto& mod : m_graphics_mods)
|
||||||
{
|
{
|
||||||
m_path_to_graphics_mod[mod.GetAbsolutePath()] = &mod;
|
m_path_to_graphics_mod[mod.GetAbsolutePath()] = &mod;
|
||||||
|
|
Loading…
Reference in New Issue