changeset 260:b72cc74a240b

Re #270: Add multiple categories to API * Save out category if it isn't the main category
author IBBoard <dev@ibboard.co.uk>
date Fri, 21 May 2010 19:41:02 +0000
parents 35dc06030355
children b9b8b0e60c31
files api/Factories/Xml/WarFoundryXmlSaver.cs
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlSaver.cs	Wed May 19 20:07:07 2010 +0000
+++ b/api/Factories/Xml/WarFoundryXmlSaver.cs	Fri May 21 19:41:02 2010 +0000
@@ -105,6 +105,12 @@
 			{
 				unitElem.SetAttribute("race", unit.Race.ID);
 			}
+			
+			Category unitCategory = unit.Category.Category;
+			if (!unit.UnitType.MainCategory.Equals(unitCategory))
+			{
+				unitElem.SetAttribute("category", unitCategory.ID);
+			}
 
 			XmlElement equipmentElem = CreateEquipmentItemsElement(unit, doc);