changeset 129:52cacdbcb001

Fixes #126: First army load fails * Re-order setting of army and setting of game system to resolve null army issues Also: * Remove commented and unused code
author IBBoard <dev@ibboard.co.uk>
date Wed, 26 Aug 2009 19:00:50 +0000
parents 45a9452579a2
children e147a1e9399b
files api/WarFoundryCore.cs
diffstat 1 files changed, 7 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/api/WarFoundryCore.cs	Wed Aug 26 18:37:55 2009 +0000
+++ b/api/WarFoundryCore.cs	Wed Aug 26 19:00:50 2009 +0000
@@ -54,29 +54,18 @@
 			{
 				if (currentArmy==null || !currentArmy.Equals(value))
 				{
-					/*if (currentArmy!=null)
-					{
-						currentArmy.UnitAdded-= UnitAddedMethod;
-						currentArmy.UnitRemoved-= UnitRemovedMethod;
-						currentArmy.PointsValueChanged-= PointsValueChangedMethod;
-						currentArmy.FailedRequirement-=FailedUnitRequirementMethod;
-					}*/
 					Army oldArmy = currentArmy;
-					currentArmy = value;
 					
-					if (currentArmy!=null)
+					if (value != null)
 					{
-						CurrentGameSystem = currentArmy.GameSystem; //Set the game system in case the new army is from a different system
+						CurrentGameSystem = value.GameSystem; //Set the game system in case the new army is from a different system
+						currentArmy = value;
 					}
-
-					/*if (currentArmy!=null)
+					else
 					{
-						currentArmy.UnitAdded+= UnitAddedMethod;
-						currentArmy.UnitRemoved+= UnitRemovedMethod;
-						currentArmy.PointsValueChanged+= PointsValueChangedMethod;
-						currentArmy.FailedRequirement+=FailedUnitRequirementMethod;
-					}*/
-
+						currentArmy = null;
+					}
+					
 					if (ArmyChanged!=null)
 					{
 						ArmyChanged(oldArmy, currentArmy);