Mercurial > repos > IBDev-IBBoard.WarFoundry.API
annotate api/Commands/RemoveUnitCommand.cs @ 194:1412a42190a1
* Fix mutex group clash checking
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 30 Oct 2009 20:23:03 +0000 |
parents | 2f3cafb69799 |
children | 391446c9b250 |
rev | line source |
---|---|
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
1 // This file (RemoveUnitCommand.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2007, 2008, 2009 IBBoard. |
15 | 2 // |
104
2f3cafb69799
Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents:
82
diff
changeset
|
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
82 | 4 |
5 using System; | |
0 | 6 using IBBoard.Commands; |
82 | 7 using IBBoard.WarFoundry.API.Objects; |
8 | |
9 namespace IBBoard.WarFoundry.API.Commands | |
10 { | |
11 /// <summary> | |
12 /// Summary description for RemoveUnitCommand. | |
13 /// </summary> | |
14 public class RemoveUnitCommand : Command | |
15 { | |
16 private Unit unit; | |
17 private ArmyCategory cat; | |
18 | |
19 public RemoveUnitCommand(Unit toRemove) | |
20 { | |
21 unit = toRemove; | |
22 cat = unit.Category; | |
23 } | |
24 | |
25 public override bool CanExecute() | |
26 { | |
27 return (unit!=null); | |
28 } | |
29 | |
30 public override string Description | |
31 { | |
32 get { return "Remove an existing unit from the army"; } | |
33 } | |
34 | |
35 public override string UndoDescription | |
36 { | |
37 get { return "Replace a removed unit"; } | |
38 } | |
39 | |
40 public override bool Execute() | |
41 { | |
42 this.Redo(); | |
43 return true; | |
44 } | |
45 | |
46 public override void Redo() | |
47 { | |
48 cat.RemoveUnit(unit); | |
49 } | |
50 | |
51 public override void Undo() | |
52 { | |
53 cat.AddUnit(unit); | |
54 } | |
55 | |
56 public override string Name | |
57 { | |
58 get { return "Remove unit"; } | |
59 } | |
60 } | |
61 } |