From 4ed5ed3d65a3faf6e0d81091ded82e8fdc2fb14e Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Sun, 31 May 2020 16:12:23 +0100 Subject: [PATCH] implement Clone --- Cargo.toml | 2 +- src/colour.rs | 2 +- src/dialogue.rs | 2 +- src/ending.rs | 2 +- src/exit.rs | 4 ++-- src/game.rs | 2 +- src/image.rs | 2 +- src/item.rs | 2 +- src/lib.rs | 4 ++-- src/palette.rs | 2 +- src/position.rs | 2 +- src/room.rs | 2 +- src/sprite.rs | 2 +- src/text.rs | 4 ++-- src/tile.rs | 2 +- src/variable.rs | 2 +- 16 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9233cf6..77c9c97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bitsy-parser" -version = "0.70.0" +version = "0.70.1" authors = ["Max Bradbury "] edition = "2018" description = "A parser for Bitsy game data" diff --git a/src/colour.rs b/src/colour.rs index ae34a97..6aa9487 100644 --- a/src/colour.rs +++ b/src/colour.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Colour { pub red: u8, pub green: u8, diff --git a/src/dialogue.rs b/src/dialogue.rs index e243e6c..26a8e90 100644 --- a/src/dialogue.rs +++ b/src/dialogue.rs @@ -1,6 +1,6 @@ use crate::optional_data_line; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Dialogue { pub id: String, pub contents: String, diff --git a/src/ending.rs b/src/ending.rs index 132b927..b283721 100644 --- a/src/ending.rs +++ b/src/ending.rs @@ -3,7 +3,7 @@ use std::error::Error; use std::str::FromStr; // same as a dialogue basically -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Ending { id: String, dialogue: String, diff --git a/src/exit.rs b/src/exit.rs index a1cffec..f7eb20c 100644 --- a/src/exit.rs +++ b/src/exit.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use std::error::Error; use std::fmt; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Transition { None, FadeToWhite, @@ -51,7 +51,7 @@ impl ToString for Transition { } } -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Exit { /// destination pub room_id: u64, diff --git a/src/game.rs b/src/game.rs index 87da5a4..9e9c6a1 100644 --- a/src/game.rs +++ b/src/game.rs @@ -65,7 +65,7 @@ impl Version { } } -#[derive(Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq)] pub struct Game { pub name: String, pub version: Option, diff --git a/src/image.rs b/src/image.rs index 7f5b02e..31cbe27 100644 --- a/src/image.rs +++ b/src/image.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Image { pub pixels: Vec, // 64 for SD, 256 for HD } diff --git a/src/item.rs b/src/item.rs index 33b737d..91a032e 100644 --- a/src/item.rs +++ b/src/item.rs @@ -1,7 +1,7 @@ use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36}; use crate::image::animation_frames_from_string; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Item { pub id: u64, pub animation_frames: Vec, diff --git a/src/lib.rs b/src/lib.rs index 70c868f..de5ebc2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,13 +36,13 @@ use text::{Font, TextDirection}; use tile::Tile; use variable::Variable; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Instance { position: Position, id: String, // item / ending.rs id } -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct ExitInstance { position: Position, exit: Exit, diff --git a/src/palette.rs b/src/palette.rs index eae6dc0..5fde93c 100644 --- a/src/palette.rs +++ b/src/palette.rs @@ -1,7 +1,7 @@ use crate::colour::Colour; use crate::{from_base36, ToBase36}; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Palette { pub id: u64, pub name: Option, diff --git a/src/position.rs b/src/position.rs index 390eee5..2736b8d 100644 --- a/src/position.rs +++ b/src/position.rs @@ -2,7 +2,7 @@ use std::error::Error; use std::fmt; use std::str::FromStr; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Position { pub x: u8, pub y: u8, diff --git a/src/room.rs b/src/room.rs index 132bdb4..94a3a90 100644 --- a/src/room.rs +++ b/src/room.rs @@ -3,7 +3,7 @@ use crate::game::{RoomType, RoomFormat}; use crate::exit::Transition; use std::str::FromStr; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Room { pub id: u64, pub palette_id: Option, // optional in very early versions diff --git a/src/sprite.rs b/src/sprite.rs index 8244890..1bdc3e8 100644 --- a/src/sprite.rs +++ b/src/sprite.rs @@ -2,7 +2,7 @@ use crate::{from_base36, optional_data_line, AnimationFrames, Image, Position, T use crate::image::animation_frames_from_string; use std::str::FromStr; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Sprite { pub id: u64, pub name: Option, diff --git a/src/text.rs b/src/text.rs index ee0c8f0..2591633 100644 --- a/src/text.rs +++ b/src/text.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum Font { AsciiSmall, // default - does not appear in game data UnicodeEuropeanSmall, @@ -32,7 +32,7 @@ impl Font { } } -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub enum TextDirection { LeftToRight, // default RightToLeft, diff --git a/src/tile.rs b/src/tile.rs index 3ea2924..381882e 100644 --- a/src/tile.rs +++ b/src/tile.rs @@ -1,7 +1,7 @@ use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36}; use crate::image::animation_frames_from_string; -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Tile { pub id: u64, pub name: Option, diff --git a/src/variable.rs b/src/variable.rs index 8f225ed..687b5f1 100644 --- a/src/variable.rs +++ b/src/variable.rs @@ -1,4 +1,4 @@ -#[derive(Debug, Eq, PartialEq)] +#[derive(Clone, Debug, Eq, PartialEq)] pub struct Variable { pub id: String, pub initial_value: String,