remove trait lookup spam everywhere for IOccupySpace.

This commit is contained in:
Chris Forbes
2011-08-02 19:43:02 +12:00
parent aff3111eac
commit 663a323f29
11 changed files with 35 additions and 37 deletions

View File

@@ -35,12 +35,12 @@ namespace OpenRA.Mods.RA.Activities
if( IsCanceled || !target.IsValid) return NextActivity;
var mobile = self.Trait<Mobile>();
Pair<int2, SubCell>[] cells = new Pair<int2, SubCell>[] {};
var cells = new Pair<int2, SubCell>[] {};
if (target.IsActor)
cells = target.Actor.Trait<IOccupySpace>().OccupiedCells().ToArray();
cells = target.Actor.OccupiesSpace.OccupiedCells().ToArray();
if (cells.Length == 0)
cells = new OpenRA.FileFormats.Pair<int2, SubCell>[] {
cells = new [] {
Pair.New(Util.CellContaining(target.CenterLocation), SubCell.FullCell) };
var ps1 = new PathSearch( self.World, mobile.Info, self.Owner )