diff --git a/OpenRA.Game/Network/Session.cs b/OpenRA.Game/Network/Session.cs index 98301611b3..7f7835cb56 100644 --- a/OpenRA.Game/Network/Session.cs +++ b/OpenRA.Game/Network/Session.cs @@ -61,9 +61,9 @@ namespace OpenRA.Network public bool IsAdmin; public bool IsReady { get { return State == ClientState.Ready; } } public bool IsObserver { get { return Slot == null; } } - public int Ping = -1; - public int PingJitter = -1; - public int[] PingHistory = {}; + public int Latency = -1; + public int LatencyJitter = -1; + public int[] LatencyHistory = {}; } public class Slot diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index b962608669..3f3e4af03e 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -469,16 +469,16 @@ namespace OpenRA.Server break; } - var history = fromClient.PingHistory.ToList(); + var history = fromClient.LatencyHistory.ToList(); history.Add(Environment.TickCount - pingSent); // Cap ping history at 5 values (25 seconds) if (history.Count > 5) history.RemoveRange(0, history.Count - 5); - fromClient.Ping = history.Sum() / history.Count; - fromClient.PingJitter = (history.Max() - history.Min())/2; - fromClient.PingHistory = history.ToArray(); + fromClient.Latency = history.Sum() / history.Count; + fromClient.LatencyJitter = (history.Max() - history.Min())/2; + fromClient.LatencyHistory = history.ToArray(); if (State == ServerState.WaitingPlayers) SyncLobbyInfo(); diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs index 44d80257eb..e57c09181e 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyLogic.cs @@ -388,7 +388,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (template == null || template.Id != EditablePlayerTemplate.Id) template = EditablePlayerTemplate.Clone(); - LobbyUtils.SetupAdminPingWidget(template, slot, client, orderManager, client.Bot == null); + LobbyUtils.SetupClientWidget(template, slot, client, orderManager, client.Bot == null); if (client.Bot != null) LobbyUtils.SetupEditableSlotWidget(template, slot, client, orderManager); @@ -408,7 +408,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (template == null || template.Id != NonEditablePlayerTemplate.Id) template = NonEditablePlayerTemplate.Clone(); - LobbyUtils.SetupAdminPingWidget(template, slot, client, orderManager, client.Bot == null); + LobbyUtils.SetupClientWidget(template, slot, client, orderManager, client.Bot == null); LobbyUtils.SetupNameWidget(template, slot, client); LobbyUtils.SetupKickWidget(template, slot, client, orderManager); LobbyUtils.SetupColorWidget(template, slot, client); @@ -459,7 +459,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic LobbyUtils.SetupReadyWidget(template, null, client); } - LobbyUtils.SetupAdminPingWidget(template, null, c, orderManager, true); + LobbyUtils.SetupClientWidget(template, null, c, orderManager, true); template.IsVisible = () => true; if (idx >= Players.Children.Count) diff --git a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs index 09ba31f0a8..3fc94ad7f3 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/LobbyUtils.cs @@ -158,26 +158,26 @@ namespace OpenRA.Mods.RA.Widgets.Logic } } - static Color GetPingColor(Session.Client c) + static Color GetLatencyColor(Session.Client c) { - if (c.Ping < 0) // Ping unknown + if (c.Latency < 0) // Ping unknown return Color.Gray; - if (c.Ping > 720) // OrderLag > 6 + if (c.Latency > 720) // OrderLag > 6 return Color.Red; - if (c.Ping > 360) // OrderLag > 3 + if (c.Latency > 360) // OrderLag > 3 return Color.Orange; return Color.LimeGreen; } - public static void SetupAdminPingWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, bool visible) + public static void SetupClientWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager, bool visible) { parent.Get("ADMIN_INDICATOR").IsVisible = () => c.IsAdmin; - var block = parent.Get("PING_BLOCK"); + var block = parent.Get("LATENCY"); block.IsVisible = () => visible; if (visible) - block.Get("PING_COLOR").GetColor = () => GetPingColor(c); + block.Get("LATENCY_COLOR").GetColor = () => GetLatencyColor(c); } public static void SetupEditableNameWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager) diff --git a/mods/cnc/chrome/lobby.yaml b/mods/cnc/chrome/lobby.yaml index 28907a96df..bf1e029182 100644 --- a/mods/cnc/chrome/lobby.yaml +++ b/mods/cnc/chrome/lobby.yaml @@ -73,7 +73,7 @@ Container@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Background@PING_BLOCK: + Background@LATENCY: Background:button X:0 Y:6 @@ -81,7 +81,7 @@ Container@SERVER_LOBBY: Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -161,7 +161,7 @@ Container@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Background@PING_BLOCK: + Background@LATENCY: Background:button X:0 Y:6 @@ -169,7 +169,7 @@ Container@SERVER_LOBBY: Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -263,7 +263,7 @@ Container@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Background@PING_BLOCK: + Background@LATENCY: Background:button X:0 Y:6 @@ -271,7 +271,7 @@ Container@SERVER_LOBBY: Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -319,7 +319,7 @@ Container@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Background@PING_BLOCK: + Background@LATENCY: Background:button X:0 Y:6 @@ -327,7 +327,7 @@ Container@SERVER_LOBBY: Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 diff --git a/mods/d2k/chrome/lobby.yaml b/mods/d2k/chrome/lobby.yaml index 6abb365c69..d5645d4a28 100644 --- a/mods/d2k/chrome/lobby.yaml +++ b/mods/d2k/chrome/lobby.yaml @@ -54,14 +54,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -140,14 +140,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -240,14 +240,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -302,14 +302,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 diff --git a/mods/ra/chrome/lobby.yaml b/mods/ra/chrome/lobby.yaml index d087512504..f67699e16b 100644 --- a/mods/ra/chrome/lobby.yaml +++ b/mods/ra/chrome/lobby.yaml @@ -54,14 +54,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -140,14 +140,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -240,14 +240,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4 @@ -302,14 +302,14 @@ Background@SERVER_LOBBY: ImageName:admin X:2 Visible:false - Container@PING_BLOCK: + Container@LATENCY: X:0 Y:6 Width:11 Height:14 Visible:false Children: - ColorBlock@PING_COLOR: + ColorBlock@LATENCY_COLOR: X:2 Y:2 Width:PARENT_RIGHT-4