diff --git a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs index 0ad9531e24..b2ccc9caee 100755 --- a/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs +++ b/OpenRA.Mods.RA/Player/ClassicProductionQueue.cs @@ -23,15 +23,15 @@ namespace OpenRA.Mods.RA public class ClassicProductionQueue : ProductionQueue, ISync { public ClassicProductionQueue( Actor self, ClassicProductionQueueInfo info ) - : base(self, self, info as ProductionQueueInfo) {} + : base(self, self, info) {} + + [Sync] bool isActive = false; - [Sync] bool QueueActive = false; public override void Tick( Actor self ) { - QueueActive = self.World.ActorsWithTrait() - .Where(x => x.Actor.Owner == self.Owner) - .Where(x => x.Trait.Info.Produces.Contains(Info.Type)) - .Any(); + isActive = self.World.ActorsWithTrait() + .Any(x => x.Actor.Owner == self.Owner + && x.Trait.Info.Produces.Contains(Info.Type)); base.Tick(self); } @@ -39,21 +39,20 @@ namespace OpenRA.Mods.RA static ActorInfo[] None = { }; public override IEnumerable AllItems() { - return QueueActive ? base.AllItems() : None; + return isActive ? base.AllItems() : None; } public override IEnumerable BuildableItems() { - return QueueActive ? base.BuildableItems() : None; + return isActive ? base.BuildableItems() : None; } protected override bool BuildUnit( string name ) { // Find a production structure to build this actor - var producers = self.World - .ActorsWithTrait() - .Where(x => x.Actor.Owner == self.Owner) - .Where(x => x.Trait.Info.Produces.Contains(Info.Type)) + var producers = self.World.ActorsWithTrait() + .Where(x => x.Actor.Owner == self.Owner + && x.Trait.Info.Produces.Contains(Info.Type)) .OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary. if (producers.Count() == 0)