diff api/Factories/Xml/WarFoundryXmlRaceFactory.cs @ 154:4a02c07278e7

Re #185: Problems with decimals in race definitions * Fix race factory so that it parses unit costs as doubles, not ints Also: * Line ending clean-up
author IBBoard <dev@ibboard.co.uk>
date Mon, 28 Sep 2009 19:32:52 +0000
parents 0c0e14f03785
children 62ff1ac132d2
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Sep 26 19:57:06 2009 +0000
+++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Mon Sep 28 19:32:52 2009 +0000
@@ -129,8 +129,8 @@
 			type.MaxSize = XmlTools.GetIntValueFromAttribute(elem, "maxSize");
 			type.MinSize = XmlTools.GetIntValueFromAttribute(elem, "minSize");
 			type.BaseSize = XmlTools.GetIntValueFromAttribute(elem, "baseSize");
-			type.CostPerTrooper = XmlTools.GetIntValueFromAttribute(elem, "points");
-			type.BaseUnitCost = XmlTools.GetIntValueFromAttribute(elem, "unitPoints");
+			type.CostPerTrooper = XmlTools.GetDoubleValueFromAttribute(elem, "points");
+			type.BaseUnitCost = XmlTools.GetDoubleValueFromAttribute(elem, "unitPoints");
 			string mainCatID = elem.GetAttribute("cat");
 			Category cat = type.Race.GetCategory(mainCatID);
 			
@@ -154,29 +154,29 @@
 				
 				if (equipItem!=null)
 				{
-					string mutexGroupString = equip.GetAttribute("exclusivityGroups");
-					string[] mutexGroups;
-
-					if (mutexGroupString == "")
-					{
-						mutexGroupString = equip.GetAttribute("exclusivityGroup");
-					}
-
-					if (mutexGroupString != "")
-					{
-						string[] groups = mutexGroupString.Split(',');
-						int groupCount = groups.Length;
-
-						for (int i = 0; i < groupCount; i++)
-						{
-							groups[i] = groups[i].Trim();
-						}
-
-						mutexGroups = groups;
-					}
-					else
-					{
-						mutexGroups = new string[0];
+					string mutexGroupString = equip.GetAttribute("exclusivityGroups");
+					string[] mutexGroups;
+
+					if (mutexGroupString == "")
+					{
+						mutexGroupString = equip.GetAttribute("exclusivityGroup");
+					}
+
+					if (mutexGroupString != "")
+					{
+						string[] groups = mutexGroupString.Split(',');
+						int groupCount = groups.Length;
+
+						for (int i = 0; i < groupCount; i++)
+						{
+							groups[i] = groups[i].Trim();
+						}
+
+						mutexGroups = groups;
+					}
+					else
+					{
+						mutexGroups = new string[0];
 					}
 
 					UnitEquipmentItem unitEquipItem = new UnitEquipmentItem(equipItem, type, mutexGroups);