From f2d8e32b0182e6ec71f56b0371bca94b7c54a97b Mon Sep 17 00:00:00 2001 From: reaperrr Date: Wed, 17 Jun 2015 21:42:15 +0200 Subject: [PATCH] Selection box size now defaults to Selectable.Bounds if VisualBounds are null --- OpenRA.Game/Actor.cs | 8 +++++--- mods/cnc/rules/defaults.yaml | 6 ------ mods/d2k/rules/defaults.yaml | 4 ---- mods/ra/rules/defaults.yaml | 1 - mods/ts/rules/defaults.yaml | 2 -- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index 49d0e23b56..e8d704cf59 100644 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -115,11 +115,13 @@ namespace OpenRA visualBounds = Exts.Lazy(() => { var sd = Info.Traits.GetOrDefault(); - var size = (sd != null && sd.SelectionBoxBounds != null) ? new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]) : - TraitsImplementing().Select(x => x.SelectionSize(this)).FirstOrDefault(); + if (sd == null || sd.SelectionBoxBounds == null) + return bounds.Value; + + var size = new int2(sd.SelectionBoxBounds[0], sd.SelectionBoxBounds[1]); var offset = -size / 2; - if (sd != null && sd.SelectionBoxBounds != null && sd.SelectionBoxBounds.Length > 2) + if (sd.SelectionBoxBounds.Length > 2) offset += new int2(sd.SelectionBoxBounds[2], sd.SelectionBoxBounds[3]); return new Rectangle(offset.X, offset.Y, size.X, size.Y); diff --git a/mods/cnc/rules/defaults.yaml b/mods/cnc/rules/defaults.yaml index 0ba840498f..cf5195edfc 100644 --- a/mods/cnc/rules/defaults.yaml +++ b/mods/cnc/rules/defaults.yaml @@ -33,7 +33,6 @@ Beach: 50 ROT: 5 SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: @@ -82,7 +81,6 @@ Beach: 70 ROT: 5 SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: @@ -128,7 +126,6 @@ TargetTypes: Air GroundedTargetTypes: Ground SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 Helicopter: @@ -183,7 +180,6 @@ PathingCost: 300 Beach: 80 SelectionDecorations: - VisualBounds: 12,17,0,-6 Selectable: Bounds: 12,17,0,-6 TargetableUnit: @@ -305,7 +301,6 @@ BlueTiberium: 70 Beach: 80 SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: @@ -337,7 +332,6 @@ AppearsOnRadar: UseLocation: yes SelectionDecorations: - VisualBounds: 24,24 Selectable: Bounds: 24,24 TargetableUnit: diff --git a/mods/d2k/rules/defaults.yaml b/mods/d2k/rules/defaults.yaml index ef344629ad..f05b780298 100644 --- a/mods/d2k/rules/defaults.yaml +++ b/mods/d2k/rules/defaults.yaml @@ -34,7 +34,6 @@ Dune: 60 ROT: 5 SelectionDecorations: - VisualBounds: 32,32 Selectable: Bounds: 32,32 TargetableUnit: @@ -91,7 +90,6 @@ Dune: 70 ROT: 5 SelectionDecorations: - VisualBounds: 32,32 Selectable: Bounds: 32,32 TargetableUnit: @@ -217,7 +215,6 @@ Dune: 60 Rough: 70 SelectionDecorations: - VisualBounds: 12,18,0,-6 Selectable: Bounds: 12,18,0,-6 TargetableUnit: @@ -275,7 +272,6 @@ AppearsOnRadar: UseLocation: yes SelectionDecorations: - VisualBounds: 32,32 Selectable: Bounds: 32,32 TargetableAircraft: diff --git a/mods/ra/rules/defaults.yaml b/mods/ra/rules/defaults.yaml index 1fdcff33ec..9de3e1a045 100644 --- a/mods/ra/rules/defaults.yaml +++ b/mods/ra/rules/defaults.yaml @@ -181,7 +181,6 @@ Gems: 80 Beach: 80 SelectionDecorations: - VisualBounds: 12,18,0,-8 Selectable: Bounds: 12,18,0,-8 TargetableUnit: diff --git a/mods/ts/rules/defaults.yaml b/mods/ts/rules/defaults.yaml index 205ddccbe4..0415035970 100644 --- a/mods/ts/rules/defaults.yaml +++ b/mods/ts/rules/defaults.yaml @@ -212,7 +212,6 @@ BlueTiberium: 80 SelectionDecorations: Palette: pips - VisualBounds: 14,23,-1,-9 Selectable: Bounds: 14,23,-1,-9 Voiced: @@ -500,7 +499,6 @@ BlueTiberium: 100 SelectionDecorations: Palette: pips - VisualBounds: 26,26,0,-3 Selectable: Bounds: 26,26,0,-3 TargetableUnit: