changeset 242:ea5cb50ebe5e

Fixes #384: Validation warnings don't get cleared when creating new armies * Check whether army is valid when it changes (also means we validate on load as well as clearing on close)
author IBBoard <dev@ibboard.co.uk>
date Sat, 21 Jan 2012 16:51:07 +0000
parents dd893a582184
children 55c94d438a4b
files FrmMain.cs
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/FrmMain.cs	Sat Jan 21 16:34:18 2012 +0000
+++ b/FrmMain.cs	Sat Jan 21 16:51:07 2012 +0000
@@ -915,6 +915,7 @@
 		private void FrmMain_ArmyChanged(Army oldArmy, Army newArmy)
 		{
 			CommandStack.Reset();
+			ValidateArmy();
 			loadedFilePath = null;
 			miSaveArmy.Enabled = false;
 			bttnSaveArmy.Enabled = false;
@@ -1251,7 +1252,7 @@
         private void ValidateArmy()
         {
             ICollection<string> failureMessages;
-            if (Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages)))
+            if (CurrentArmy == null || Validates.AsOkay(RequirementHandler.ValidateArmy(CurrentArmy, out failureMessages)))
             {
                 sbErrorPanel.Text = "";
                 sbErrorPanel.Tag = "";