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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user