From 6fc8de69ac69494c54a9fd2413f045921b682f23 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 11 Aug 2015 15:02:31 +0200 Subject: [PATCH 1/3] Unreserve aircraft when removed from world --- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 9f1b43d0d4..1f8f82831d 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -194,6 +194,7 @@ namespace OpenRA.Mods.Common.Traits public void RemovedFromWorld(Actor self) { + UnReserve(); self.World.ActorMap.RemoveInfluence(self, this); self.World.ActorMap.RemovePosition(self, this); self.World.ScreenMap.Remove(self); From 9cbc16b6a342c2e322ded197c8deb1aba747d3db Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 11 Aug 2015 15:06:13 +0200 Subject: [PATCH 2/3] If aircraft has FallsToEarth, return instead of just skipping reservation. --- OpenRA.Mods.Common/Traits/Air/Helicopter.cs | 6 ++++-- OpenRA.Mods.Common/Traits/Air/Plane.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Air/Helicopter.cs b/OpenRA.Mods.Common/Traits/Air/Helicopter.cs index 0cf5cdfc13..ad014678ce 100644 --- a/OpenRA.Mods.Common/Traits/Air/Helicopter.cs +++ b/OpenRA.Mods.Common/Traits/Air/Helicopter.cs @@ -133,8 +133,10 @@ namespace OpenRA.Mods.Common.Traits if (firstTick) { firstTick = false; - if (!self.HasTrait()) // TODO: Aircraft husks don't properly unreserve. - ReserveSpawnBuilding(); + if (self.HasTrait()) // TODO: Aircraft husks don't properly unreserve. + return; + + ReserveSpawnBuilding(); var host = GetActorBelow(); if (host == null) diff --git a/OpenRA.Mods.Common/Traits/Air/Plane.cs b/OpenRA.Mods.Common/Traits/Air/Plane.cs index b993cefe03..aaa249a68a 100644 --- a/OpenRA.Mods.Common/Traits/Air/Plane.cs +++ b/OpenRA.Mods.Common/Traits/Air/Plane.cs @@ -43,8 +43,10 @@ namespace OpenRA.Mods.Common.Traits if (firstTick) { firstTick = false; - if (!self.HasTrait()) // TODO: Aircraft husks don't properly unreserve. - ReserveSpawnBuilding(); + if (self.HasTrait()) // TODO: Aircraft husks don't properly unreserve. + return; + + ReserveSpawnBuilding(); var host = GetActorBelow(); if (host == null) From d97d4c82a3d96b7c4b6f726fd240045e349d211a Mon Sep 17 00:00:00 2001 From: reaperrr Date: Tue, 11 Aug 2015 15:06:41 +0200 Subject: [PATCH 3/3] Plane style fixes --- OpenRA.Mods.Common/Traits/Air/Plane.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Air/Plane.cs b/OpenRA.Mods.Common/Traits/Air/Plane.cs index aaa249a68a..36451eed1b 100644 --- a/OpenRA.Mods.Common/Traits/Air/Plane.cs +++ b/OpenRA.Mods.Common/Traits/Air/Plane.cs @@ -95,7 +95,8 @@ namespace OpenRA.Mods.Common.Traits } else if (order.OrderString == "Enter") { - if (Reservable.IsReserved(order.TargetActor)) return; + if (Reservable.IsReserved(order.TargetActor)) + return; UnReserve(); @@ -113,7 +114,8 @@ namespace OpenRA.Mods.Common.Traits else if (order.OrderString == "ReturnToBase") { var airfield = ReturnToBase.ChooseAirfield(self, true); - if (airfield == null) return; + if (airfield == null) + return; UnReserve(); self.CancelActivity();