diff FrmNewArmy.cs @ 220:467decfdde8e

Closes #327: "Points" system should be used in UI * Add abbreviation and name as options to default name * Translation armySizePts now supports {0} (size), {1} (pts abbrev) and {2} (pts name) * Future additions of "points" systems should be coded with appropriate calls
author IBBoard <dev@ibboard.co.uk>
date Mon, 29 Aug 2011 15:17:59 +0100
parents ec2b73de16ba
children 2bde6d18d3bd
line wrap: on
line diff
--- a/FrmNewArmy.cs	Fri Aug 26 20:14:08 2011 +0100
+++ b/FrmNewArmy.cs	Mon Aug 29 15:17:59 2011 +0100
@@ -334,14 +334,15 @@
 			bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0);
 		}
 
-        private void setTxtArmyNameVal()
-        {
-            if (lstRaces.SelectedIndex > -1)
-            {
-                txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}pt", armySize.Value));
-                isDefaultArmyName = true;
-            }
-        }
+		private void setTxtArmyNameVal()
+		{
+			if (lstRaces.SelectedIndex > -1)
+			{
+				double armySizeDbl = (double)armySize.Value;
+				txtArmyName.Text = String.Format(race.ArmyDefaultName, Translation.GetTranslation("armySizePts", "{0}{1}", armySizeDbl, system.GetPointsAbbrev(armySizeDbl), system.GetPointsName(armySizeDbl)));
+				isDefaultArmyName = true;
+			}
+		}
 
         private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e)
 		{
@@ -355,16 +356,15 @@
 
 		private void gameSystems_SelectedValueChanged(object sender, EventArgs e)
 		{
-			
-            GameSystem selected = GetSelectedGameSystem();
+			system = GetSelectedGameSystem();
 			txtArmyName.Text = "";
-            txtArmyName.Enabled = false;
-            lstRaces.Items.Clear();
-            armySize.Value = selected.SystemArmyDefaultSize;
- 
-			if (selected != null)
+			txtArmyName.Enabled = false;
+			lstRaces.Items.Clear();
+			armySize.Value = system.SystemArmyDefaultSize;
+
+			if (system != null)
 			{
-				SetRaces(selected);
+				SetRaces(system);
 
 				if (lstRaces.Items.Count == 1)
 				{