1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Sort by LAN servers

This commit is contained in:
Ted John
2019-05-05 14:12:50 +00:00
parent 3a400a2471
commit 4f0a733496
2 changed files with 8 additions and 0 deletions

View File

@@ -39,6 +39,12 @@ int32_t ServerListEntry::CompareTo(const ServerListEntry& other) const
return a.favourite ? -1 : 1;
}
// Order by local
if (a.local != b.local)
{
return a.local ? 1 : -1;
}
// Then by version
bool serverACompatible = a.version == network_get_version();
bool serverBCompatible = b.version == network_get_version();
@@ -241,6 +247,7 @@ std::future<std::vector<ServerListEntry>> ServerList::FetchLocalServerListAsync(
auto entry = ServerListEntry::FromJson(jinfo);
if (entry.has_value())
{
entry.value().local = true;
entries.push_back(entry.value());
}

View File

@@ -29,6 +29,7 @@ struct ServerListEntry
bool favourite{};
uint8_t players{};
uint8_t maxplayers{};
bool local{};
int32_t CompareTo(const ServerListEntry& other) const;
bool IsVersionValid() const;