air units are targetable
This commit is contained in:
@@ -92,11 +92,8 @@ namespace OpenRa.Game
|
|||||||
if (!Rules.Map.IsInMap(xy.X, xy.Y))
|
if (!Rules.Map.IsInMap(xy.X, xy.Y))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// HACK: Get the first unit in the cell
|
var loc = mi.Location + Game.viewport.Location;
|
||||||
// This will need to be updated for multiple-infantry-in-a-cell
|
var underCursor = Game.FindUnits(loc, loc).FirstOrDefault();
|
||||||
// HACK: this doesn't work for targeting air units either
|
|
||||||
var underCursor = Game.UnitInfluence.GetUnitsAt( xy ).FirstOrDefault()
|
|
||||||
?? Game.BuildingInfluence.GetBuildingAt( xy );
|
|
||||||
|
|
||||||
if (underCursor != null && !underCursor.Info.Selectable)
|
if (underCursor != null && !underCursor.Info.Selectable)
|
||||||
underCursor = null;
|
underCursor = null;
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
var mods = GetModifierKeys();
|
var mods = GetModifierKeys();
|
||||||
var c = (orderGenerator is UnitOrderGenerator) ? orderGenerator.Order(dragEnd.ToInt2(),
|
var c = (orderGenerator is UnitOrderGenerator) ? orderGenerator.Order(dragEnd.ToInt2(),
|
||||||
new MouseInput { Button = MouseButton.Right, Modifiers = mods })
|
new MouseInput { Location = (Game.CellSize * dragEnd - Game.viewport.Location).ToInt2(), Button = MouseButton.Right, Modifiers = mods })
|
||||||
.Where(o => o.Validate())
|
.Where(o => o.Validate())
|
||||||
.Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation))
|
.Select(o => CursorForOrderString(o.OrderString, o.Subject, o.TargetLocation))
|
||||||
.FirstOrDefault(a => a != null) : null;
|
.FirstOrDefault(a => a != null) : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user