# HG changeset patch # User IBBoard # Date 1251313250 0 # Node ID 52cacdbcb001a43012e9d1c6723b8e2cbf146dac # Parent 45a9452579a22961e2bac903f104d9cd0cd39b84 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 diff -r 45a9452579a2 -r 52cacdbcb001 api/WarFoundryCore.cs --- 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);