From f74d2318d8f79a79f6dbaad9fba186e515abb75f Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 26 Feb 2011 12:57:25 +1300 Subject: [PATCH] Unreserve helipads on heli death. --- OpenRA.Mods.RA/Air/Aircraft.cs | 20 +++++++++++++++++++- OpenRA.Mods.RA/Air/Helicopter.cs | 3 +-- OpenRA.Mods.RA/Air/Plane.cs | 16 ---------------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index 87132dd7bc..99ca5e06cf 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -75,8 +75,26 @@ namespace OpenRA.Mods.RA.Air public virtual object Create( ActorInitializer init ) { return new Aircraft( init , this ); } } - public class Aircraft : IMove, IFacing, IOccupySpace, ISync + public class Aircraft : IMove, IFacing, IOccupySpace, ISync, INotifyDamage { + public IDisposable reservation; + + public void UnReserve() + { + if (reservation != null) + { + reservation.Dispose(); + reservation = null; + } + } + + public void Damaged(Actor self, AttackInfo e) + { + if (e.DamageState == DamageState.Dead) + UnReserve(); + } + + protected readonly Actor self; [Sync] public int Facing { get; set; } diff --git a/OpenRA.Mods.RA/Air/Helicopter.cs b/OpenRA.Mods.RA/Air/Helicopter.cs index c8e2bdda3e..44885b3f31 100755 --- a/OpenRA.Mods.RA/Air/Helicopter.cs +++ b/OpenRA.Mods.RA/Air/Helicopter.cs @@ -30,14 +30,13 @@ namespace OpenRA.Mods.RA.Air class Helicopter : Aircraft, ITick, IIssueOrder, IResolveOrder, IOrderVoice { - public IDisposable reservation; HelicopterInfo Info; public Helicopter( ActorInitializer init, HelicopterInfo info) : base( init, info ) { Info = info; } - + public IEnumerable Orders { get diff --git a/OpenRA.Mods.RA/Air/Plane.cs b/OpenRA.Mods.RA/Air/Plane.cs index eaba982678..21c3b780d8 100755 --- a/OpenRA.Mods.RA/Air/Plane.cs +++ b/OpenRA.Mods.RA/Air/Plane.cs @@ -27,7 +27,6 @@ namespace OpenRA.Mods.RA.Air public class Plane : Aircraft, IIssueOrder, IResolveOrder, IOrderVoice, ITick, INotifyDamage, ISync { - public IDisposable reservation; [Sync] public int2 RTBPathHash; @@ -78,21 +77,6 @@ namespace OpenRA.Mods.RA.Air return (order.OrderString == "Move" || order.OrderString == "Enter") ? "Move" : null; } - public void UnReserve() - { - if (reservation != null) - { - reservation.Dispose(); - reservation = null; - } - } - - public void Damaged(Actor self, AttackInfo e) - { - if (e.DamageState == DamageState.Dead) - UnReserve(); - } - public void ResolveOrder(Actor self, Order order) { if (order.OrderString == "Move")