From 031109d76672b889e1e6d90137db9bf9512c7869 Mon Sep 17 00:00:00 2001 From: bryanwilbur Date: Mon, 29 Jun 2015 12:54:01 -0600 Subject: [PATCH] The 'Jump to base' hotkey is useless if the Construction Yard is destroyed #3318 Now works like original Red Alert. When there are no more Construction Yards the 'Jump to base' hotkey goes to the oldest undestroyed building. --- OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs index 0f5486baaa..0c67047835 100644 --- a/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs +++ b/OpenRA.Mods.Common/Widgets/WorldCommandWidget.cs @@ -15,6 +15,7 @@ using OpenRA.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Orders; using OpenRA.Primitives; +using OpenRA.Traits; using OpenRA.Widgets; namespace OpenRA.Mods.Common.Widgets @@ -191,8 +192,20 @@ namespace OpenRA.Mods.Common.Widgets .Select(b => b.Actor) .ToList(); + // If no BaseBuilding exist pick the first selectable Building. if (!bases.Any()) - return true; + { + var building = world.ActorsWithTrait() + .Select(b => b.Actor) + .FirstOrDefault(a => a.Owner == world.LocalPlayer && a.HasTrait()); + + // No buildings left + if (building == null) + return true; + + world.Selection.Combine(world, new Actor[] { building }, false, true); + return ToSelection(); + } var next = bases .SkipWhile(b => !world.Selection.Actors.Contains(b))