Exemple #1
0
        public void AddGrounds(XElement root)
        {
            foreach (var elem in root.XPathSelectElements("//Ground"))
            {
                string id = elem.Attribute("id").Value;

                ushort type;
                var    typeAttr = elem.Attribute("type");
                type = (ushort)Utils.FromString(typeAttr.Value);

                if (typeToTileId.ContainsKey(type))
                {
                    log.Warn($"\"{id}\" and \"{typeToTileId[type]}\" has the same ID of 0x{type:x4}!");
                }
                if (idToTileType.ContainsKey(id))
                {
                    log.Warn($"0x{type:x4} and 0x{idToTileType[id]:x4} has the same name of {id}!");
                }

                typeToTileId[type]   = id;
                idToTileType[id]     = type;
                typeToTileElem[type] = elem;

                tiles[type] = new TileDesc(type, elem);

                var  extAttr = elem.Attribute("ext");
                bool ext;
                if (extAttr != null && bool.TryParse(extAttr.Value, out ext) && ext)
                {
                    addition.Add(elem);
                    updateCount++;
                }
            }
        }
Exemple #2
0
        public void AddGrounds(XElement root)
        {
            foreach (var elem in root.XPathSelectElements("//Ground"))
            {
                string id = elem.Attribute("id").Value;

                ushort type;
                var    typeAttr = elem.Attribute("type");
                type = (ushort)Utils.FromString(typeAttr.Value);

                if (type2id_tile.ContainsKey(type))
                {
                    log.WarnFormat("'{0}' and '{1}' has the same ID of 0x{2:x4}!", id, type2id_tile[type], type);
                }
                if (id2type_tile.ContainsKey(id))
                {
                    log.WarnFormat("0x{0:x4} and 0x{1:x4} has the same name of {2}!", type, id2type_tile[id], id);
                }

                type2id_tile[type]   = id;
                id2type_tile[id]     = type;
                type2elem_tile[type] = elem;

                tiles[type] = new TileDesc(type, elem);

                var  extAttr = elem.Attribute("ext");
                bool ext;
                if (extAttr != null && bool.TryParse(extAttr.Value, out ext) && ext)
                {
                    this.addition.Add(elem);
                    updateCount++;
                }
            }
        }