diff --git a/OpenRA.Mods.RA/Player/PlaceBuilding.cs b/OpenRA.Mods.RA/Player/PlaceBuilding.cs index 5a0cb331ab..b0f3f80b2c 100755 --- a/OpenRA.Mods.RA/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.RA/Player/PlaceBuilding.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - class PlaceBuildingInfo : TraitInfo {} + class PlaceBuildingInfo : TraitInfo { } class PlaceBuilding : IResolveOrder { @@ -50,8 +50,8 @@ namespace OpenRA.Mods.RA { var building = w.CreateActor(order.TargetString, new TypeDictionary { - new LocationInit( t ), - new OwnerInit( order.Player ), + new LocationInit(t), + new OwnerInit(order.Player), }); if (playSounds) @@ -70,14 +70,14 @@ namespace OpenRA.Mods.RA var building = w.CreateActor(order.TargetString, new TypeDictionary { - new LocationInit( order.TargetLocation ), - new OwnerInit( order.Player ), + new LocationInit(order.TargetLocation), + new OwnerInit(order.Player), }); foreach (var s in buildingInfo.BuildSounds) Sound.PlayToPlayer(order.Player, s, building.CenterPosition); } - PlayBuildAnim( self, unit ); + PlayBuildAnim(self, unit); queue.FinishProduction(); @@ -98,21 +98,21 @@ namespace OpenRA.Mods.RA } // finds a construction yard (or equivalent) and runs its "build" animation. - static void PlayBuildAnim( Actor self, ActorInfo unit ) + static void PlayBuildAnim(Actor self, ActorInfo unit) { var bi = unit.Traits.GetOrDefault(); if (bi == null) return; var producers = self.World.ActorsWithTrait() - .Where( x => x.Actor.Owner == self.Owner - && x.Actor.Info.Traits.Get().Produces.Contains( bi.Queue ) ) + .Where(x => x.Actor.Owner == self.Owner + && x.Actor.Info.Traits.Get().Produces.Contains(bi.Queue)) .ToList(); - var producer = producers.Where( x => x.Actor.IsPrimaryBuilding() ).Concat( producers ) + var producer = producers.Where(x => x.Actor.IsPrimaryBuilding()).Concat(producers) .FirstOrDefault(); - if( producer.Actor != null ) - producer.Actor.Trait().PlayCustomAnim( producer.Actor, "build" ); + if (producer.Actor == null) + return; } static int GetNumBuildables(Player p)