From d79d4479c7bb774f69b60d41fc4f7b7f316fce5f Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 22 Mar 2018 01:51:07 -0300 Subject: [PATCH] Work around AI orders to invalid cells. --- OpenRA.Mods.Common/Traits/Mobile.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index 8401a26639..ba73549c16 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -592,6 +592,14 @@ namespace OpenRA.Mods.Common.Traits public CPos NearestMoveableCell(CPos target, int minRange, int maxRange) { + // HACK: This entire method is a hack, and needs to be replaced with + // a proper path search that can account for movement layer transitions. + // HACK: Work around code that blindly tries to move to cells in invalid movement layers. + // This will need to change (by removing this method completely as above) before we can + // properly support user-issued orders on to elevated bridges or other interactable custom layers + if (target.Layer != 0) + target = new CPos(target.X, target.Y); + if (CanEnterCell(target)) return target;