diff --git a/OpenRA.Mods.RA/Player/ProductionQueue.cs b/OpenRA.Mods.RA/Player/ProductionQueue.cs index 9d85eadd8c..3a824bf627 100755 --- a/OpenRA.Mods.RA/Player/ProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ProductionQueue.cs @@ -225,11 +225,8 @@ namespace OpenRA.Mods.RA { var inQueue = Queue.Count(pi => pi.Item == order.TargetString); var owned = self.Owner.World.ActorsWithTrait().Count(a => a.Actor.Info.Name == order.TargetString && a.Actor.Owner == self.Owner); - if (inQueue + owned >= bi.BuildLimit) - { - Sound.PlayNotification(self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.Race); - return; - } + if (inQueue + owned >= bi.BuildLimit) + return; } for (var n = 0; n < order.TargetLocation.X; n++) // repeat count diff --git a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs index 998c5c9226..50ad00bb9f 100755 --- a/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs +++ b/OpenRA.Mods.RA/Widgets/BuildPaletteWidget.cs @@ -366,7 +366,16 @@ namespace OpenRA.Mods.RA.Widgets } } else - Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, world.LocalPlayer.Country.Race); + { + // Check if the item's build-limit has already been reached + var queued = CurrentQueue.AllQueued().Count(a => a.Item == unit.Name); + var inWorld = world.ActorsWithTrait().Count(a => a.Actor.Info.Name == unit.Name && a.Actor.Owner == world.LocalPlayer); + + if (!((unit.Traits.Get().BuildLimit != 0) && (inWorld + queued >= unit.Traits.Get().BuildLimit))) + Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, world.LocalPlayer.Country.Race); + else + Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.BlockedAudio, world.LocalPlayer.Country.Race); + } StartProduction(world, item); }