From 465ee97090c1515bcc314dba23a27abe6429b1e4 Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Tue, 10 Sep 2019 16:25:47 +0200 Subject: [PATCH] Prevent users from selecting a directional target outside the map --- .../Traits/SupportPowers/SelectDirectionalTarget.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs index 9b29e4f2e0..f41b8f0b1e 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs @@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down) { - if (!activated) + if (!activated && world.Map.Contains(cell)) { targetCell = cell; targetLocation = mi.Location; @@ -119,7 +119,10 @@ namespace OpenRA.Mods.Common.Traits IEnumerable IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world) { yield break; } - string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return cursor; } + string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) + { + return world.Map.Contains(cell) ? cursor : "generic-blocked"; + } bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }