From b3908606c3d12dd6ece9406cac50824ef050b0f2 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 7 May 2011 11:15:45 +1200 Subject: [PATCH] remove some silly cost centers in Building --- OpenRA.Mods.RA/Buildings/Building.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.RA/Buildings/Building.cs b/OpenRA.Mods.RA/Buildings/Building.cs index 015330b3af..e6991ce0e5 100755 --- a/OpenRA.Mods.RA/Buildings/Building.cs +++ b/OpenRA.Mods.RA/Buildings/Building.cs @@ -72,8 +72,9 @@ namespace OpenRA.Mods.RA.Buildings readonly int2 topLeft; PowerManager PlayerPower; + int2 pxPosition; - public int2 PxPosition { get { return ( 2 * topLeft + Info.Dimensions ) * Game.CellSize / 2; } } + public int2 PxPosition { get { return pxPosition; } } public IEnumerable ProvidesPrerequisites { get { yield return self.Info.Name; } } @@ -83,6 +84,10 @@ namespace OpenRA.Mods.RA.Buildings this.topLeft = init.Get(); this.Info = info; this.PlayerPower = init.self.Owner.PlayerActor.Trait(); + + occupiedCells = FootprintUtils.UnpathableTiles( self.Info.Name, Info, TopLeft ) + .Select(c => Pair.New(c, SubCell.FullCell)).ToArray(); + pxPosition = ( 2 * topLeft + Info.Dimensions ) * Game.CellSize / 2; } public int GetPowerUsage() @@ -106,10 +111,8 @@ namespace OpenRA.Mods.RA.Buildings get { return topLeft; } } - public IEnumerable> OccupiedCells() - { - return FootprintUtils.UnpathableTiles( self.Info.Name, Info, TopLeft ).Select(c => Pair.New(c, SubCell.FullCell)); - } + Pair[] occupiedCells; + public IEnumerable> OccupiedCells() { return occupiedCells; } public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner) {