Mercurial > repos > IBBoard.WarFoundry.API
diff API/Commands/CreateAndAddUnitCommand.cs @ 471:0a2068897793
Re #359: Add "only contained" attribute to unit types
* Add "main units" methods to get only top-level units
* Add nesting to unit creation command
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 15 Apr 2012 20:52:32 +0100 |
parents | 3c4a6403a88c |
children | e6c93ceba119 |
line wrap: on
line diff
--- a/API/Commands/CreateAndAddUnitCommand.cs Sat Apr 14 20:44:22 2012 +0100 +++ b/API/Commands/CreateAndAddUnitCommand.cs Sun Apr 15 20:52:32 2012 +0100 @@ -14,11 +14,13 @@ private UnitType addedUnitType; private ArmyCategory armyCat; private Unit addedUnit; + private Unit parentUnit; - public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory armyCatTo) + public CreateAndAddUnitCommand(UnitType toAdd, ArmyCategory armyCatTo, Unit parentUnit = null) { addedUnitType = toAdd; armyCat = armyCatTo; + this.parentUnit = parentUnit; } public override bool CanExecute() @@ -45,6 +47,7 @@ public override bool Execute() { addedUnit = new Unit(addedUnitType, armyCat); + addedUnit.ParentUnit = parentUnit; this.Redo(); return true; }