fixed index outside bounds of the array when 0 productions left

closes #4137
This commit is contained in:
Matthias Mailänder
2013-11-17 15:48:28 +01:00
parent 5d3987dee3
commit 9e50f577a0

View File

@@ -107,7 +107,7 @@ namespace OpenRA.Mods.RA
.Where(p => p.Trait.Info.Produces.Contains(unit.Traits.Get<BuildableInfo>().Queue))
.Where(p => p.Actor.Owner == self.Owner).ToArray();
var speedModifier = Math.Min(selfsameBuildings.Count(), Info.BuildTimeSpeedReduction.Length) - 1;
var speedModifier = selfsameBuildings.Count().Clamp(1, Info.BuildTimeSpeedReduction.Length) - 1;
time = (time * Info.BuildTimeSpeedReduction[speedModifier]) / 100;
}