private 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.Warn("'{0}' and '{1}' has the same ID of 0x{2:x4}!", id, type2id_tile[type], type); } if (id2type_tile.ContainsKey(id)) { Log.Warn("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); } }
private 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++; } } }
private void AddGrounds(XElement root) { foreach (var e in root.Elements("Ground")) { var id = e.GetAttribute <string>("id"); var type = e.GetAttribute <ushort>("type"); if (TileTypeToId.ContainsKey(type)) { Log.Warn("'{0}' and '{1}' have the same type of '0x{2:x4}'", id, TileTypeToId[type], type); } if (IdToTileType.ContainsKey(id)) { Log.Warn("'0x{0:x4}' and '0x{1:x4}' have the same id of '{2}'", type, IdToTileType[id], id); } TileTypeToId[type] = id; TileTypeToElement[type] = e; IdToTileType[id] = type; Tiles[type] = new TileDesc(type, e); } }