From c430884c8b317ab44ed2015a1494bc7710bc8b07 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 12 Jan 2020 10:48:43 +0000 Subject: [PATCH] Require GeoLite2 database path to be specified by the server operator. --- OpenRA.Game/Network/GameServer.cs | 3 +++ OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Network/GameServer.cs b/OpenRA.Game/Network/GameServer.cs index 0df3700b0a..d810a76739 100644 --- a/OpenRA.Game/Network/GameServer.cs +++ b/OpenRA.Game/Network/GameServer.cs @@ -97,6 +97,9 @@ namespace OpenRA.Network /// URL to a 32x32 px icon for the mod. public readonly string ModIcon32 = ""; + /// GeoIP resolved server location. + public readonly string Location = ""; + /// Password protected public readonly bool Protected = false; diff --git a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs index 670f9baaf2..16b678dafd 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/ServerListLogic.cs @@ -370,6 +370,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (addressNode != null) addressNode.Value.Value = bl.Address.ToString().Split(':')[0] + ":" + addressNode.Value.Value.Split(':')[1]; + game.Nodes.Add(new MiniYamlNode("Location", "Local Network")); + lanGames.Add(new GameServer(game)); } } @@ -658,8 +660,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (location != null) { var font = Game.Renderer.Fonts[location.Font]; - var cachedServerLocation = game.Id != -1 ? GeoIP.LookupCountry(game.Address.Split(':')[0]) : "Local Network"; - var label = WidgetUtils.TruncateText(cachedServerLocation, location.Bounds.Width, font); + var label = WidgetUtils.TruncateText(game.Location, location.Bounds.Width, font); location.GetText = () => label; location.GetColor = () => canJoin ? location.TextColor : incompatibleGameColor; }