implement Clone

This commit is contained in:
Max Bradbury 2020-05-31 16:12:23 +01:00
parent ea09d06b35
commit 4ed5ed3d65
16 changed files with 19 additions and 19 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "bitsy-parser"
version = "0.70.0"
version = "0.70.1"
authors = ["Max Bradbury <max@tinybird.info>"]
edition = "2018"
description = "A parser for Bitsy game data"

View File

@ -1,4 +1,4 @@
#[derive(Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Colour {
pub red: u8,
pub green: u8,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -65,7 +65,7 @@ impl Version {
}
}
#[derive(Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq)]
pub struct Game {
pub name: String,
pub version: Option<Version>,

View File

@ -1,4 +1,4 @@
#[derive(Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Image {
pub pixels: Vec<u8>, // 64 for SD, 256 for HD
}

View File

@ -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<Image>,

View File

@ -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,

View File

@ -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<String>,

View File

@ -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,

View File

@ -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<u64>, // optional in very early versions

View File

@ -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<String>,

View File

@ -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,

View File

@ -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<String>,

View File

@ -1,4 +1,4 @@
#[derive(Debug, Eq, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Variable {
pub id: String,
pub initial_value: String,