changeset 3:2a21138f50ed

Re #9 - Make WarFoundry API use smaller methods * Use new UnitType constructor * Add units to race * Cascade up unit loading function hierarchy instead of jumping a step
author IBBoard <dev@ibboard.co.uk>
date Sun, 18 Jan 2009 20:54:26 +0000
parents 9b17b3e35b9d
children c82b194801dc
files RollcallFactory.cs
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/RollcallFactory.cs	Sun Jan 18 15:39:18 2009 +0000
+++ b/RollcallFactory.cs	Sun Jan 18 20:54:26 2009 +0000
@@ -148,7 +148,7 @@
 
 		private UnitType ReadUnitTypeSectionFromID(IniFile file, String sectionID, Race race)
 		{
-			return ReadUnitTypeSection(file, file["Unit"+sectionID], race);
+			return ReadUnitTypeSection(file, "Unit"+sectionID, race);
 		}
 
 		private UnitType ReadUnitTypeSection(IniFile file, String sectionName, Race race)
@@ -164,11 +164,12 @@
 			{
 				string unitID = GetUnitID(section);
 				string name = section["Name"].Value;
-				string catID = section["Category"].Value;
-				string[] cats = new string[]{ catID };
+				unitType = new UnitType(unitID, name, race);
+				Category mainCat = race.GetCategory(section["Category"].Value);
+				unitType.AddCategory(mainCat);
+				unitType.MainCategory = mainCat;
 				//Load other values
-				unitType = new UnitType(unitID, name, catID, cats, 0, 1, 1, 1, 10, 10, null, null, race);
-				//race.AddUnitType(unitType);
+				race.AddUnitType(unitType);
 			}
 
 			return unitType;