From 91866819948498acf8eec94331bda65a07cb28e5 Mon Sep 17 00:00:00 2001 From: Alejandro Perea Date: Mon, 13 Feb 2023 15:53:06 +0100 Subject: [PATCH 1/4] Misc doc fixes (#247) --- src/layers/tile/mod.rs | 2 +- src/map.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layers/tile/mod.rs b/src/layers/tile/mod.rs index 109554c4..09dbc3f0 100644 --- a/src/layers/tile/mod.rs +++ b/src/layers/tile/mod.rs @@ -57,7 +57,7 @@ impl LayerTileData { | Self::FLIPPED_VERTICALLY_FLAG | Self::FLIPPED_DIAGONALLY_FLAG; - /// Creates a new [`LayerTileData`] from a [`GID`] plus its flipping bits. + /// Creates a new [`LayerTileData`] from a [`Gid`] plus its flipping bits. pub(crate) fn from_bits(bits: u32, tilesets: &[MapTilesetGid]) -> Option { let flags = bits & Self::ALL_FLIP_FLAGS; let gid = Gid(bits & !Self::ALL_FLIP_FLAGS); diff --git a/src/map.rs b/src/map.rs index 8da96a97..7b6c569c 100644 --- a/src/map.rs +++ b/src/map.rs @@ -315,7 +315,7 @@ impl fmt::Display for Orientation { /// Tiled also treats GID 0 as empty space, which means that the first tileset in the map will have /// a starting GID of 1. /// -/// See also: https://doc.mapeditor.org/en/latest/reference/global-tile-ids/ +/// See also: #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub(crate) struct Gid(pub u32); From 310a798f970ff2398ae240bc3784ddcd54c9fb3c Mon Sep 17 00:00:00 2001 From: Alejandro Perea Date: Mon, 13 Feb 2023 16:31:53 +0100 Subject: [PATCH 2/4] Update base64 & sfml (#249) --- CHANGELOG.md | 3 ++- Cargo.toml | 4 ++-- src/layers/tile/util.rs | 8 +++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 357b063f..74aa49f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Update `zstd` to `0.12.0`. -- Update `sfml` dev dependency to `0.19.0`. +- Update `sfml` dev dependency to `0.20.0`. +- Update `base64` to `0.21.0`. ## [0.10.2] ### Added diff --git a/Cargo.toml b/Cargo.toml index d696de1e..310ca411 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,11 +27,11 @@ name = "sfml" path = "examples/sfml/main.rs" [dependencies] -base64 = "0.13.0" +base64 = "0.21.0" xml-rs = "0.8.4" libflate = "1.1.2" zstd = { version = "0.12.0", optional = true } [dev-dependencies.sfml] -version = "0.19.0" +version = "0.20.0" features = ["graphics"] diff --git a/src/layers/tile/util.rs b/src/layers/tile/util.rs index e1820f43..4f3c4f90 100644 --- a/src/layers/tile/util.rs +++ b/src/layers/tile/util.rs @@ -1,5 +1,6 @@ use std::{convert::TryInto, io::Read}; +use base64::Engine; use xml::reader::XmlEvent; use crate::{util::XmlEventResult, Error, LayerTileData, MapTilesetGid, Result}; @@ -36,7 +37,12 @@ fn parse_base64(parser: &mut impl Iterator) -> Result { - return base64::decode(s.trim().as_bytes()).map_err(Error::Base64DecodingError) + return base64::engine::GeneralPurpose::new( + &base64::alphabet::STANDARD, + base64::engine::general_purpose::PAD, + ) + .decode(s.trim().as_bytes()) + .map_err(Error::Base64DecodingError) } XmlEvent::EndElement { name, .. } if name.local_name == "data" => { return Ok(Vec::new()); From 18500d4c0670ca2cdb4d8dff762a82eba15af983 Mon Sep 17 00:00:00 2001 From: Alejandro Perea Date: Mon, 13 Feb 2023 16:32:09 +0100 Subject: [PATCH 3/4] Revert breaking change (#248) * Revert breaking change * Update changelog --- CHANGELOG.md | 1 - src/tile.rs | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74aa49f1..ffe4fb14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Support for tile offsets. Tilesets now have an `offset_x` and `offset_y` property. ### Deprecated -- `Tile::tile_type`: Use `Tile::user_type` instead. - `Object::obj_type` Use `Object::user_type` instead. ### Changed diff --git a/src/tile.rs b/src/tile.rs index 1450b23f..df860f65 100644 --- a/src/tile.rs +++ b/src/tile.rs @@ -27,9 +27,8 @@ pub struct TileData { /// The animation frames of this tile. pub animation: Option>, /// The type of this tile. - pub user_type: Option, - /// This property has been renamed to `user_type`. - #[deprecated(since = "0.10.3", note = "Use [`TileData::user_type`] instead")] + // TODO(0.11.0): Rename to `user_type` (https://github.com/mapeditor/rs-tiled/pull/238, postponed because of + // breaking change) pub tile_type: Option, /// The probability of this tile. pub probability: f32, @@ -108,8 +107,7 @@ impl TileData { properties, collision: objectgroup, animation, - tile_type: user_type.clone(), - user_type, + tile_type: user_type, probability: probability.unwrap_or(1.0), }, )) From bf184414b42fbda34ed90d15a7fe18ce6eaa30c3 Mon Sep 17 00:00:00 2001 From: Alejandro Perea Date: Mon, 13 Feb 2023 16:32:24 +0100 Subject: [PATCH 4/4] Update version to 0.10.3 & fix deps badge (#250) * Update version & deps badge * Update changelog unreleased label --- CHANGELOG.md | 2 +- Cargo.toml | 2 +- README.md | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ffe4fb14..7fffa035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.10.3] ### Added - Support for Wang sets. - Support for Tiled 1.9 `Class` property. Maps, tilesets and layers now have a `user_type` property. diff --git a/Cargo.toml b/Cargo.toml index 310ca411..786b5d75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tiled" -version = "0.10.2" +version = "0.10.3" description = "A rust crate for loading maps created by the Tiled editor" categories = ["game-development"] keywords = ["gamedev", "tiled", "tmx", "map"] diff --git a/README.md b/README.md index 7bd1abc6..0c43319a 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # rs-tiled ```toml -tiled = "0.10.2" +tiled = "0.10.3" ``` [![Rust](https://github.com/mapeditor/rs-tiled/actions/workflows/rust.yml/badge.svg)](https://github.com/mapeditor/rs-tiled/actions/workflows/rust.yml) [![Crates.io](https://img.shields.io/crates/v/tiled.svg)](https://crates.io/crates/tiled) -[![dependency status](https://deps.rs/crate/tiled/0.10.2/status.svg)](https://deps.rs/crate/tiled/0.10.2) +[![dependency status](https://deps.rs/crate/tiled/latest/status.svg)](https://deps.rs/crate/tiled) A crate for reading TMX (map) and TSX (tileset) files from the [Tiled Map Editor](http://www.mapeditor.org/) into Rust. It provides a huge set of features as well as a strong wrapper over internal features such as GIDs.