Skip to content

Commit

Permalink
Fix ProductionBar visually glitching for units without value
Browse files Browse the repository at this point in the history
  • Loading branch information
abcdefg30 authored and PunkPun committed Oct 11, 2023
1 parent d349209 commit 85c8f6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion OpenRA.Mods.Common/Traits/Render/ProductionBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ void ITick.Tick(Actor self)
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()
Expand Down

0 comments on commit 85c8f6c

Please sign in to comment.