From e69cb90dbef5c5c82f9ae860ccbdeb7f034f885e Mon Sep 17 00:00:00 2001 From: Chris Bessent Date: Sat, 16 Jan 2021 20:09:12 -0700 Subject: Improve performance by changing the map to be case insensitive --- src/modinfo.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/modinfo.h') diff --git a/src/modinfo.h b/src/modinfo.h index 634ea900..f18bd347 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -43,6 +43,12 @@ class QDateTime; namespace MOBase { class IPluginGame; } namespace MOShared { class DirectoryEntry; } +struct ModNameCompare { + bool operator()(const QString& lhs, const QString& rhs) const { + return QString::compare(lhs, rhs, Qt::CaseInsensitive) < 0; + } +}; + /** * @brief Represents meta information about a single mod. * @@ -989,7 +995,7 @@ protected: static QMutex s_Mutex; static std::vector s_Collection; static ModInfo::Ptr s_Overwrite; - static std::map s_ModsByName; + static std::map s_ModsByName; static std::map, std::vector> s_ModsByModID; static int s_NextID; -- cgit v1.3.1