Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Factories/Xml/WarFoundryXmlFactory.cs @ 51:b271a2252758
Re #50 - Fully load XML files
* Load remaining GameSystem attributes
* Add "AllowAllies" property to GameSystem class
* Add "is loading" methods to "staged loading" interface
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 28 Mar 2009 21:00:35 +0000 |
parents | bb6b993b98bf |
children | 64ef178c18aa |
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlFactory.cs Sat Mar 28 20:51:06 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlFactory.cs Sat Mar 28 21:00:35 2009 +0000 @@ -284,6 +284,9 @@ string defaultStatsID = statsElem.GetAttribute("defaultStats"); LoadSystemStatsForSystem(system, extraData); system.StandardSystemStatsID = defaultStatsID; + XmlElement systemElement = SelectSingleElement(extraData, "/system:system"); + system.WarnOnError = XmlTools.GetBoolValueFromAttribute(systemElement, "warn"); + system.AllowAllies = XmlTools.GetBoolValueFromAttribute(systemElement, "allowAllies"); LogNotifier.DebugFormat(GetType(), "Completed loading of GameSystem with ID {0}", system.ID); LogNotifier.DebugFormat(GetType(), "GameSystem with ID {0} default stats: {1}", system.ID, system.StandardSystemStatsID); system.SetAsFullyLoaded(); @@ -309,8 +312,6 @@ private void LoadCategoriesForSystem(GameSystem system, XmlNode elem) { - WarFoundryObject tempObj; - foreach (XmlElement cat in SelectNodes(elem, "/system:system/system:categories/cat:cat")) { system.AddCategory(CreateCategoryFromElement(cat)); @@ -354,13 +355,12 @@ public void CompleteLoading(Race race) { - if (!CanCompleteLoading(system)) + if (!CanCompleteLoading(race)) { return; } - race.SetAsLoading(); - + race.SetAsLoading(); XmlDocument extraData = GetExtraData(race); foreach (XmlElement node in SelectNodes(extraData, "/race:race/race:units/race:unit"))