Require GeoLite2 database path to be specified by the server operator.
This commit is contained in:
@@ -97,6 +97,9 @@ namespace OpenRA.Network
|
|||||||
/// <summary>URL to a 32x32 px icon for the mod.</summary>
|
/// <summary>URL to a 32x32 px icon for the mod.</summary>
|
||||||
public readonly string ModIcon32 = "";
|
public readonly string ModIcon32 = "";
|
||||||
|
|
||||||
|
/// <summary>GeoIP resolved server location.</summary>
|
||||||
|
public readonly string Location = "";
|
||||||
|
|
||||||
/// <summary>Password protected</summary>
|
/// <summary>Password protected</summary>
|
||||||
public readonly bool Protected = false;
|
public readonly bool Protected = false;
|
||||||
|
|
||||||
|
|||||||
@@ -370,6 +370,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (addressNode != null)
|
if (addressNode != null)
|
||||||
addressNode.Value.Value = bl.Address.ToString().Split(':')[0] + ":" + addressNode.Value.Value.Split(':')[1];
|
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));
|
lanGames.Add(new GameServer(game));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -658,8 +660,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (location != null)
|
if (location != null)
|
||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[location.Font];
|
var font = Game.Renderer.Fonts[location.Font];
|
||||||
var cachedServerLocation = game.Id != -1 ? GeoIP.LookupCountry(game.Address.Split(':')[0]) : "Local Network";
|
var label = WidgetUtils.TruncateText(game.Location, location.Bounds.Width, font);
|
||||||
var label = WidgetUtils.TruncateText(cachedServerLocation, location.Bounds.Width, font);
|
|
||||||
location.GetText = () => label;
|
location.GetText = () => label;
|
||||||
location.GetColor = () => canJoin ? location.TextColor : incompatibleGameColor;
|
location.GetColor = () => canJoin ? location.TextColor : incompatibleGameColor;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user