(a00338777) v0.9.2.1

This commit is contained in:
Joonas Rikkonen
2019-08-26 19:58:19 +03:00
parent 0f63da27b2
commit 80698b58b0
311 changed files with 11763 additions and 4507 deletions
@@ -46,16 +46,36 @@ namespace Facepunch.Steamworks
internal static Server FromSteam( Client client, SteamNative.gameserveritem_t item )
{
int serverNameLength = item.ServerName.Length;
for (int i = 0; i < item.ServerName.Length; i++)
{
if (item.ServerName[i] == '\0')
{
serverNameLength = i;
break;
}
}
int mapLength = item.Map.Length;
for (int i = 0; i < item.Map.Length; i++)
{
if (item.Map[i] == '\0')
{
mapLength = i;
break;
}
}
return new Server()
{
Client = client,
Address = Utility.Int32ToIp( item.NetAdr.IP ),
ConnectionPort = item.NetAdr.ConnectionPort,
QueryPort = item.NetAdr.QueryPort,
Name = Encoding.UTF8.GetString(item.ServerName),
Name = Encoding.UTF8.GetString(item.ServerName, 0, serverNameLength),
Ping = item.Ping,
GameDir = item.GameDir,
Map = Encoding.UTF8.GetString(item.Map),
Map = Encoding.UTF8.GetString(item.Map, 0, mapLength),
Description = item.GameDescription,
AppId = item.AppID,
Players = item.Players,