Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
diff FrmArmyTree.cs @ 10:19bdbb80999c
Closes #47 - Remove magic numbers
* Replace "magic number" -1s in WinForms with WarFoundryCore.INFINITY
Also:
* Code cleanup to remove warnings
* Code cleanup to replace space indentation with tabs
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 19 May 2009 18:51:32 +0000 |
parents | 8935971e307c |
children | 475d3cdb75f4 |
line wrap: on
line diff
--- a/FrmArmyTree.cs Tue May 19 11:10:07 2009 +0000 +++ b/FrmArmyTree.cs Tue May 19 18:51:32 2009 +0000 @@ -34,11 +34,11 @@ private ObjectAddDelegate UnitAddedMethod; private ObjectRemoveDelegate UnitRemovedMethod; private StringValChangedDelegate UnitNameChangedMethod, ArmyNameChangedMethod, TreeNameChangedMethod; - private CommandStack commandStack; + private CommandStack commandStack; public FrmArmyTree(CommandStack cmdStack) { - commandStack = cmdStack; + commandStack = cmdStack; InitializeComponent(); UnitAddedMethod = new ObjectAddDelegate(AddUnit); UnitRemovedMethod = new ObjectRemoveDelegate(RemoveUnit); @@ -161,7 +161,7 @@ for (int i = 0; i<cats.Length; i++) { units = army.GetUnits(cats[i]); - cats[i].NameChanged += TreeNameChangedMethod; + cats[i].NameChanged += TreeNameChangedMethod; TreeNode[] unitNodes = new TreeNode[units.Length]; TreeNode temp; @@ -185,7 +185,7 @@ private TreeNode createTreeNode(Unit unit) { - TreeNode temp = new TreeNode(unit.Name); + TreeNode temp = new TreeNode(unit.Name); temp.Tag = unit; unit.NameChanged+= UnitNameChangedMethod; htNodes[unit.ID] = temp; @@ -203,17 +203,17 @@ public void FrmArmyTree_ArmyChanged(Army oldArmy, Army newArmy) { - if (oldArmy != null) - { - oldArmy.UnitAdded -= UnitAddedMethod; - oldArmy.UnitRemoved -= UnitRemovedMethod; - } + if (oldArmy != null) + { + oldArmy.UnitAdded -= UnitAddedMethod; + oldArmy.UnitRemoved -= UnitRemovedMethod; + } - if (newArmy != null) + if (newArmy != null) { - newArmy.UnitAdded += UnitAddedMethod; - newArmy.UnitRemoved += UnitRemovedMethod; - SetArmy(newArmy); + newArmy.UnitAdded += UnitAddedMethod; + newArmy.UnitRemoved += UnitRemovedMethod; + SetArmy(newArmy); } else { @@ -345,7 +345,7 @@ if (node!=null) { - node.Text = unit.Name; + node.Text = unit.Name; } } } @@ -359,7 +359,7 @@ if (node!=null) { - node.Text = army.Name; + node.Text = army.Name; } } } @@ -379,7 +379,7 @@ if (node!=null) { - node.Text = obj.Name; + node.Text = obj.Name; } } }