From c7f780eb1dd3b03bdeb8b5459ce0258221e43f0d Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 8 Oct 2011 22:04:21 +1300 Subject: [PATCH] factor out GetActorBelow from ReserveSpawnBuilding --- OpenRA.Mods.RA/Air/Aircraft.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index 8d8e232ef1..87b4bc6de1 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -124,14 +124,20 @@ namespace OpenRA.Mods.RA.Air Info = info; } - protected void ReserveSpawnBuilding( Actor self ) + public Actor GetActorBelow( Actor self ) { if (self.Trait().Altitude != 0) - return; + return null; // not on the ground. - /* not spawning in the air, so try to assoc. with our afld. this is a hack. */ - var afld = self.World.FindUnits(self.CenterLocation, self.CenterLocation) + return self.World.FindUnits(self.CenterLocation, self.CenterLocation) .FirstOrDefault( a => a.HasTrait() ); + } + + protected void ReserveSpawnBuilding( Actor self ) + { + /* not spawning in the air, so try to assoc. with our afld. this is a hack. */ + + var afld = GetActorBelow(self); if (afld == null) return;