From 6828c4c1e981e357a589604e779094ed2d15fc4b Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 12 Apr 2020 13:06:49 +0100 Subject: [PATCH] Fix long player locations overrunning the player tooltip. --- OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs index dcb17c1ce4..3fb984658f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/PlayerProfileLogic.cs @@ -322,8 +322,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (client.Location != null) { + var locationFont = Game.Renderer.Fonts[locationLabel.Font]; + var locationWidth = widget.Bounds.Width - 2 * locationLabel.Bounds.X; + var location = WidgetUtils.TruncateText(client.Location, locationWidth, locationFont); locationLabel.IsVisible = () => true; - locationLabel.GetText = () => client.Location; + locationLabel.GetText = () => location; widget.Bounds.Height += locationLabel.Bounds.Height; ipLabel.Bounds.Y += locationLabel.Bounds.Height; adminLabel.Bounds.Y += locationLabel.Bounds.Height;