From f13e6fb76d76e4776c73fa786655f234bc38b990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 13 Sep 2020 10:00:41 +0200 Subject: [PATCH] Fix Analyzer warning V3008 variable is assigned values twice. --- .../Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs index 9c151fb5ae..a805749b73 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/SpawnSelectorTooltipLogic.cs @@ -33,7 +33,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic // Width specified in YAML is used as the margin between flag / label and label / border var labelMargin = widget.Bounds.Width; - var cachedWidth = 0; var labelText = ""; string playerFaction = null; var playerTeam = -1; @@ -67,13 +66,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic } label.Bounds.X = playerFaction != null ? flag.Bounds.Right + labelMargin : labelMargin; - - var textWidth = ownerFont.Measure(labelText).X; - if (textWidth != cachedWidth) - { - label.Bounds.Width = textWidth; - widget.Bounds.Width = 2 * label.Bounds.X + textWidth; - } + label.Bounds.Width = ownerFont.Measure(labelText).X; widget.Bounds.Width = Math.Max(teamWidth + 2 * labelMargin, label.Bounds.Right + labelMargin); team.Bounds.Width = widget.Bounds.Width;