internal override void Link() { base.Link(); if (SiteID.HasValue && World.Sites.ContainsKey(SiteID.Value)) { Site = World.Sites[SiteID.Value]; } if (SubregionID.HasValue && World.Regions.ContainsKey(SubregionID.Value)) { Subregion = World.Regions[SubregionID.Value]; } if (Group1HFID != null) { Group1HF = new List <HistoricalFigure>(); foreach (var group1hfid in Group1HFID.Where(group1hfid => World.HistoricalFigures.ContainsKey(group1hfid))) { Group1HF.Add(World.HistoricalFigures[group1hfid]); } } if (Group2HFID == null) { return; } Group2HF = new List <HistoricalFigure>(); foreach (var group2hfid in Group2HFID.Where(group2hfid => World.HistoricalFigures.ContainsKey(group2hfid))) { Group2HF.Add(World.HistoricalFigures[group2hfid]); } }
public HE_HFReunion(XDocument xdoc, World world) : base(xdoc, world) { foreach (XElement element in xdoc.Root.Elements()) { string val = element.Value.ToString(); int valI; Int32.TryParse(val, out valI); switch (element.Name.LocalName) { case "id": case "year": case "seconds72": case "type": break; case "site_id": if (valI != -1) { SiteID = valI; } break; case "subregion_id": if (valI != -1) { SubregionID = valI; } break; case "feature_layer_id": if (valI != -1) { FeatureLayerID = valI; } break; case "group_1_hfid": if (Group1HFID == null) { Group1HFID = new List <int>(); } Group1HFID.Add(valI); break; case "group_2_hfid": if (Group2HFID == null) { Group2HFID = new List <int>(); } Group2HFID.Add(valI); break; default: DFXMLParser.UnexpectedXMLElement(xdoc.Root.Name.LocalName + "\t" + HistoricalEvent.Types[Type], element, xdoc.Root.ToString()); break; } } }
public HE_HFSimpleBattleEvent(XDocument xdoc, World world) : base(xdoc, world) { foreach (var element in xdoc.Root.Elements()) { var val = element.Value; int valI; Int32.TryParse(val, out valI); switch (element.Name.LocalName) { case "id": case "year": case "seconds72": case "type": break; case "site_id": if (valI != -1) { SiteID = valI; } break; case "subregion_id": if (valI != -1) { SubregionID = valI; } break; case "feature_layer_id": if (valI != -1) { FeatureLayerID = valI; } break; case "subtype": if (!Subtypes.Contains(val)) { Subtypes.Add(val); } Subtype = Subtypes.IndexOf(val); break; case "group_1_hfid": if (Group1HFID == null) { Group1HFID = new List <int>(); } Group1HFID.Add(valI); break; case "group_2_hfid": if (Group2HFID == null) { Group2HFID = new List <int>(); } Group2HFID.Add(valI); break; default: DFXMLParser.UnexpectedXMLElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString()); break; } } }