Added secondary sorting by fullname when sorting systems

This commit is contained in:
Leon Styhre 2023-11-04 19:18:09 +01:00
parent c1be597075
commit 498190d9f4

View file

@ -813,9 +813,19 @@ bool SystemData::loadConfig()
<< " (collections not included)";
LOG(LogInfo) << "Total game count: " << gameCount;
// Sort systems by sortName, which will normally be the same as the full name.
// Sort systems by sortName, and always perform secondary sorting by the full name.
std::sort(std::begin(sSystemVector), std::end(sSystemVector), [](SystemData* a, SystemData* b) {
return Utils::String::toUpper(a->getSortName()) < Utils::String::toUpper(b->getSortName());
if (Utils::String::toUpper(a->getSortName()) < Utils::String::toUpper(b->getSortName()))
return true;
if (Utils::String::toUpper(a->getSortName()) > Utils::String::toUpper(b->getSortName()))
return false;
if (Utils::String::toUpper(a->getFullName()) < Utils::String::toUpper(b->getFullName()))
return true;
if (Utils::String::toUpper(a->getFullName()) > Utils::String::toUpper(b->getFullName()))
return false;
return false;
});
// Don't load any collections if there are no systems available.