diff --git a/src/test-resources/basic/tiles/avatar.toml b/src/test-resources/basic/tiles/avatar.toml deleted file mode 100644 index 3ac6a9c..0000000 --- a/src/test-resources/basic/tiles/avatar.toml +++ /dev/null @@ -1 +0,0 @@ -images = ["avatar"] diff --git a/src/test-resources/basic/tiles/block.toml b/src/test-resources/basic/tiles/block.toml new file mode 100644 index 0000000..1e33ec9 --- /dev/null +++ b/src/test-resources/basic/tiles/block.toml @@ -0,0 +1,2 @@ +images = ["block"] +wall = false diff --git a/src/tile.rs b/src/tile.rs index 10763f9..15754e7 100644 --- a/src/tile.rs +++ b/src/tile.rs @@ -9,6 +9,7 @@ pub struct Tile { /// todo should there be animation options? reverse, random, etc? /// todo do we need a "current frame" property or leave that up to the player implementation? pub images: Vec, + pub wall: bool, } impl Tile { @@ -19,13 +20,14 @@ impl Tile { &read_to_string(path).unwrap() ).unwrap(); - Tile { name, images: intermediate.images } + Tile { name, images: intermediate.images, wall: intermediate.wall } } } #[derive(Debug, Eq, PartialEq, Serialize, Deserialize)] struct IntermediateTile { images: Vec, + wall: bool, } #[cfg(test)] @@ -35,9 +37,15 @@ mod test { #[test] fn from_file() { - let path = PathBuf::from("src/test-resources/basic/tiles/avatar.toml"); + let path = PathBuf::from("src/test-resources/basic/tiles/block.toml"); let output = Tile::from_file(path); - let expected = Tile { name: "avatar".into(), images: vec!["avatar".to_string()] }; + + let expected = Tile { + name: "block".into(), + images: vec!["block".to_string()], + wall: false + }; + assert_eq!(output, expected); } }