From e7e4f2f825575f2013eb07c9b51767fc9c414516 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Thu, 29 Oct 2015 11:00:59 +0100 Subject: [PATCH] Fix base range circle not being shown during building placement --- OpenRA.Mods.Common/Traits/Buildings/Building.cs | 13 ++++++++++++- OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs | 13 +------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 14b96d36e0..cd339b44ad 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.Linq; +using OpenRA.Graphics; using OpenRA.Primitives; using OpenRA.Traits; @@ -20,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits public class GivesBuildableAreaInfo : TraitInfo { } public class GivesBuildableArea { } - public class BuildingInfo : ITraitInfo, IOccupySpaceInfo, UsesInit + public class BuildingInfo : ITraitInfo, IOccupySpaceInfo, IPlaceBuildingDecorationInfo, UsesInit { [Desc("Where you are allowed to place the building (Water, Clear, ...)")] public readonly HashSet TerrainTypes = new HashSet(); @@ -114,6 +115,16 @@ namespace OpenRA.Mods.Common.Traits } bool IOccupySpaceInfo.SharesCell { get { return false; } } + + public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) + { + if (!RequiresBaseProvider) + yield break; + + foreach (var a in w.ActorsWithTrait()) + foreach (var r in a.Trait.RenderAfterWorld(wr)) + yield return r; + } } public class Building : IOccupySpace, INotifySold, INotifyTransform, ISync, INotifyCreated, INotifyAddedToWorld, INotifyRemovedFromWorld, ITargetablePositions diff --git a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs index 1e0446f419..c4e5a92d3c 100644 --- a/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs +++ b/OpenRA.Mods.Common/Traits/Player/PlaceBuilding.cs @@ -11,14 +11,13 @@ using System.Collections.Generic; using System.Linq; using OpenRA.Effects; -using OpenRA.Graphics; using OpenRA.Primitives; using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Allows the player to execute build orders.", " Attach this to the player actor.")] - public class PlaceBuildingInfo : ITraitInfo, IPlaceBuildingDecorationInfo + public class PlaceBuildingInfo : ITraitInfo { [Desc("Palette to use for rendering the placement sprite.")] [PaletteReference] public readonly string Palette = "terrain"; @@ -30,16 +29,6 @@ namespace OpenRA.Mods.Common.Traits public readonly string NewOptionsNotification = "NewOptions"; public object Create(ActorInitializer init) { return new PlaceBuilding(this); } - - public IEnumerable Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition) - { - if (!ai.TraitInfo().RequiresBaseProvider) - yield break; - - foreach (var a in w.ActorsWithTrait()) - foreach (var r in a.Trait.RenderAfterWorld(wr)) - yield return r; - } } public class PlaceBuilding : IResolveOrder