Clamp out of bounds attack-move orders to the edge of the map.

This commit is contained in:
Paul Chote
2017-09-24 16:35:41 +01:00
committed by reaperrr
parent 36af2107d6
commit e93183f0eb

View File

@@ -140,12 +140,15 @@ namespace OpenRA.Mods.Common.Traits
protected virtual IEnumerable<Order> OrderInner(World world, CPos cell, MouseInput mi)
{
if (mi.Button == expectedButton && world.Map.Contains(cell))
if (mi.Button == expectedButton)
{
world.CancelInputMode();
var queued = mi.Modifiers.HasModifier(Modifiers.Shift);
var orderName = mi.Modifiers.HasModifier(Modifiers.Ctrl) ? "AssaultMove" : "AttackMove";
// Cells outside the playable area should be clamped to the edge for consistency with move orders
cell = world.Map.Clamp(cell);
foreach (var s in subjects)
yield return new Order(orderName, s.Actor, queued) { TargetLocation = cell };
}