From 85c8f6c446f4ff871e6152129a69370efdfb217b Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 2 Oct 2023 21:15:28 +0200 Subject: [PATCH] Fix ProductionBar visually glitching for units without value --- OpenRA.Mods.Common/Traits/Render/ProductionBar.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs index c22c1454aa..9b5165ec43 100644 --- a/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs +++ b/OpenRA.Mods.Common/Traits/Render/ProductionBar.cs @@ -77,7 +77,12 @@ namespace OpenRA.Mods.Common.Traits.Render return; var current = queue.AllQueued().Where(i => i.Started).MinByOrDefault(i => i.RemainingTime); - value = current != null ? 1 - (float)current.RemainingCost / current.TotalCost : 0; + if (current == null) + value = 0; + else if (current.TotalCost <= 0) + value = 1; + else + value = 1 - (float)current.RemainingCost / current.TotalCost; } float ISelectionBar.GetValue()