diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index 9502290f06..762602463d 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -120,6 +120,23 @@ namespace OpenRA.Mods.RA.Air Info = info; } + protected void ReserveSpawnBuilding( Actor self ) + { + if (self.Trait().Altitude != 0) + return; + + /* 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) + .FirstOrDefault( a => a.HasTrait() ); + + if (afld == null) + return; + + var res = afld.Trait(); + if (res != null) + reservation = res.Reserve(afld, self, this); + } + public int ROT { get { return Info.ROT; } } public int InitialFacing { get { return Info.InitialFacing; } } diff --git a/OpenRA.Mods.RA/Air/Plane.cs b/OpenRA.Mods.RA/Air/Plane.cs index a8ac3cc87d..82dab3384f 100755 --- a/OpenRA.Mods.RA/Air/Plane.cs +++ b/OpenRA.Mods.RA/Air/Plane.cs @@ -33,19 +33,7 @@ namespace OpenRA.Mods.RA.Air if (firstTick) { firstTick = false; - if (self.Trait().Altitude == 0) - { - /* 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) - .FirstOrDefault( a => a.HasTrait() ); - - if (afld != null) - { - var res = afld.Trait(); - if (res != null) - reservation = res.Reserve(afld, self, this); - } - } + ReserveSpawnBuilding(self); } }