Prevent users from selecting a directional target outside the map

This commit is contained in:
abcdefg30
2019-09-10 16:25:47 +02:00
committed by teinarss
parent a8b1762464
commit 465ee97090

View File

@@ -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<IRenderable> 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; }