Fix ProductionBar visually glitching for units without value

This commit is contained in:
abcdefg30
2023-10-02 21:15:28 +02:00
committed by Gustas
parent d349209dc9
commit 85c8f6c446

View File

@@ -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()