From eebdd6d041f2bbdb21c2538dbc1ac2d9e5869f09 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 11 Jan 2016 23:39:06 +0000 Subject: [PATCH 1/2] Fix width of server location column. --- mods/cnc/chrome/multiplayer-browser.yaml | 4 ++-- mods/ra/chrome/multiplayer-browser.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/cnc/chrome/multiplayer-browser.yaml b/mods/cnc/chrome/multiplayer-browser.yaml index fb351bdb49..0b7ccb5015 100644 --- a/mods/cnc/chrome/multiplayer-browser.yaml +++ b/mods/cnc/chrome/multiplayer-browser.yaml @@ -22,7 +22,7 @@ Container@MULTIPLAYER_BROWSER_PANEL: Font: Bold Label@LOCATION: X: 380 - Width: 120 + Width: 110 Height: 25 Text: Country Font: Bold @@ -71,7 +71,7 @@ Container@MULTIPLAYER_BROWSER_PANEL: Height: 25 Label@LOCATION: X: 380 - Width: 120 + Width: 110 Height: 25 Label@STATUS: X: 495 diff --git a/mods/ra/chrome/multiplayer-browser.yaml b/mods/ra/chrome/multiplayer-browser.yaml index d7623af41e..63cb76b1de 100644 --- a/mods/ra/chrome/multiplayer-browser.yaml +++ b/mods/ra/chrome/multiplayer-browser.yaml @@ -22,7 +22,7 @@ Container@MULTIPLAYER_BROWSER_PANEL: Font: Bold Label@LOCATION: X: 380 - Width: 120 + Width: 110 Height: 25 Text: Country Font: Bold @@ -72,7 +72,7 @@ Container@MULTIPLAYER_BROWSER_PANEL: Height: 25 Label@LOCATION: X: 380 - Width: 120 + Width: 110 Height: 25 Label@STATUS: X: 495 From 675faa2a6d48defbb082121c8ec3d1b4cae6e5f8 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 11 Jan 2016 23:39:14 +0000 Subject: [PATCH 2/2] Truncate long server locations. --- OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs index 0e85b65068..7d3f350922 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MultiplayerLogic.cs @@ -402,8 +402,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic var location = item.GetOrNull("LOCATION"); if (location != null) { + var font = Game.Renderer.Fonts[location.Font]; var cachedServerLocation = GeoIP.LookupCountry(game.Address.Split(':')[0]); - location.GetText = () => cachedServerLocation; + var label = WidgetUtils.TruncateText(cachedServerLocation, location.Bounds.Width, font); + location.GetText = () => label; location.GetColor = () => canJoin ? location.TextColor : incompatibleGameColor; }