#93 shift selection

This commit is contained in:
Chris Forbes
2009-12-05 17:14:23 +13:00
parent 9b1d74951a
commit 522bf234b8
3 changed files with 30 additions and 5 deletions

View File

@@ -93,8 +93,14 @@ namespace OpenRa.Game
{
if (!(orderGenerator is PlaceBuilding))
{
orderGenerator = new UnitOrderGenerator(
Game.SelectActorsInBox(Game.CellSize * dragStart, Game.CellSize * xy));
var newSelection = Game.SelectActorsInBox(Game.CellSize * dragStart, Game.CellSize * xy);
var oldSelection = (orderGenerator is UnitOrderGenerator)
? (orderGenerator as UnitOrderGenerator).selection : new Actor[] { }.AsEnumerable();
if (dragStart == xy)
orderGenerator = new UnitOrderGenerator(mi.Modifiers.HasModifier(Keys.Shift) ? oldSelection.SymmetricDifference(newSelection) : newSelection);
else
orderGenerator = new UnitOrderGenerator(mi.Modifiers.HasModifier(Keys.Shift) ? oldSelection.Union(newSelection) : newSelection);
var voicedUnit = ((UnitOrderGenerator)orderGenerator).selection
.Where(a => a.traits.Contains<Unit>()