Esempio n. 1
0
        public HE_HFReachSummit(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 "subregion_id":
                    if (valI != -1)
                    {
                        SubregionID = valI;
                    }
                    break;

                case "feature_layer_id":
                    if (valI != -1)
                    {
                        FeatureLayerID = valI;
                    }
                    break;

                case "coords":
                    if (val != "-1,-1")
                    {
                        Coords = new Point(Convert.ToInt32(val.Split(',')[0]), Convert.ToInt32(val.Split(',')[1]));
                    }
                    break;

                case "group_hfid":
                    if (GroupHFID == null)
                    {
                        GroupHFID = new List <int>();
                    }
                    GroupHFID.Add(valI);
                    break;

                default:
                    DFXMLParser.UnexpectedXMLElement(xdoc.Root.Name.LocalName + "\t" + Types[Type], element, xdoc.Root.ToString());
                    break;
                }
            }
        }
Esempio n. 2
0
        internal override void Link()
        {
            base.Link();

            if (SubregionID.HasValue && World.Regions.ContainsKey(SubregionID.Value))
            {
                Subregion = World.Regions[SubregionID.Value];
            }

            if (GroupHFID != null)
            {
                GroupHF = new List <HistoricalFigure>();
                foreach (var group1hfid in GroupHFID.Where(group1hfid => World.HistoricalFigures.ContainsKey(group1hfid)))
                {
                    GroupHF.Add(World.HistoricalFigures[group1hfid]);
                }
            }
        }