changeset 199:f9ef9b2db496

Re #343: Show unit requirement failures * Add missing translation for dialog * Add first pass of showing messages when adding units (needs reworking due to space limitations)
author IBBoard <dev@ibboard.co.uk>
date Sun, 01 May 2011 19:31:26 +0000
parents 417d3f75a752
children 77043c3e0d94
files FrmNewUnit.cs translations/en.translation
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/FrmNewUnit.cs	Sun May 01 19:30:33 2011 +0000
+++ b/FrmNewUnit.cs	Sun May 01 19:31:26 2011 +0000
@@ -2,7 +2,8 @@
 //
 // 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.
 
-using System;
+using System;
+using System.Collections.Generic;
 using System.Drawing;
 using System.ComponentModel;
 using System.Windows.Forms;
@@ -198,14 +199,14 @@
 		{
 			if (lstUnits.SelectedIndex>-1)
 			{
-				bttnSelectUnit.Enabled = true;
-				lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army));
+				bttnSelectUnit.Enabled = true;
+                ICollection<string> failureMessages;
+				lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army, out failureMessages));
 				lblWarningIcon.Visible = lblNewUnitWarning.Visible;
 
 				if (lblNewUnitWarning.Visible)
 				{
-					//lblNewUnitWarning.Text = army.GetFailedAddRequirement(units[lstUnits.SelectedIndex]).Description;
-                    //FIXME: Add failed requirement text
+					lblNewUnitWarning.Text = String.Join("\n", new List<string>(failureMessages).ToArray());
 				}
 			}
 			else
--- a/translations/en.translation	Sun May 01 19:30:33 2011 +0000
+++ b/translations/en.translation	Sun May 01 19:31:26 2011 +0000
@@ -130,4 +130,5 @@
   <translation id="GameSystemFilesReloaded">Game system and race files reloaded</translation>
   <translation id="treeNodeText">{0} ({1} {2})</translation>
   <translation id="setUnitEquipmentItemName">( {0} {1} each)</translation>
+  <translation id="FailedRequirementMessage">Army Requirement Failures</translation>
 </translations>
\ No newline at end of file