# HG changeset patch # User IBBoard # Date 1238274035 0 # Node ID b271a2252758b387e8c18658c5db5a08dd0246cf # Parent bb6b993b98bfc18b499371e7401581fda50a8201 Re #50 - Fully load XML files * Load remaining GameSystem attributes * Add "AllowAllies" property to GameSystem class * Add "is loading" methods to "staged loading" interface diff -r bb6b993b98bf -r b271a2252758 api/Factories/Xml/WarFoundryXmlFactory.cs --- 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")) diff -r bb6b993b98bf -r b271a2252758 api/Objects/GameSystem.cs --- a/api/Objects/GameSystem.cs Sat Mar 28 20:51:06 2009 +0000 +++ b/api/Objects/GameSystem.cs Sat Mar 28 21:00:35 2009 +0000 @@ -17,7 +17,8 @@ /// public class GameSystem : WarFoundryStagedLoadingObject { - private bool warnOnError; + private bool warnOnError; + private bool allowAllies; private Dictionary categories = new Dictionary(); private Dictionary stats = new Dictionary(); private string defaultStats; @@ -26,14 +27,12 @@ { stats = new Dictionary(); } - - /*public void CompleteLoading(Category[] cats, Dictionary sysStats, string defaultStatsID) + + public bool AllowAllies { - categories = cats; - stats = new SystemStatsSet(sysStats); - defaultStats = defaultStatsID; - base.CompleteLoading(); - }*/ + get { return allowAllies; } + set { allowAllies = value; } + } public void AddCategory(Category cat) { diff -r bb6b993b98bf -r b271a2252758 api/Objects/IWarFoundryStagedLoadObject.cs --- a/api/Objects/IWarFoundryStagedLoadObject.cs Sat Mar 28 20:51:06 2009 +0000 +++ b/api/Objects/IWarFoundryStagedLoadObject.cs Sat Mar 28 21:00:35 2009 +0000 @@ -26,9 +26,19 @@ /// bool IsFullyLoaded { get; } + /// + /// Returns true if the object is in the process of being fully loaded with all data, else returns false + /// + bool IsLoading { get; } + /// /// Marks the object as fully loaded so that no more load checking is required. /// void SetAsFullyLoaded(); + + /// + /// Markes the object as being in the process of being fully loaded. + /// + void SetAsLoading(); } }