implement Clone
This commit is contained in:
parent
ea09d06b35
commit
4ed5ed3d65
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bitsy-parser"
|
name = "bitsy-parser"
|
||||||
version = "0.70.0"
|
version = "0.70.1"
|
||||||
authors = ["Max Bradbury <max@tinybird.info>"]
|
authors = ["Max Bradbury <max@tinybird.info>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A parser for Bitsy game data"
|
description = "A parser for Bitsy game data"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Colour {
|
pub struct Colour {
|
||||||
pub red: u8,
|
pub red: u8,
|
||||||
pub green: u8,
|
pub green: u8,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::optional_data_line;
|
use crate::optional_data_line;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Dialogue {
|
pub struct Dialogue {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub contents: String,
|
pub contents: String,
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::error::Error;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
// same as a dialogue basically
|
// same as a dialogue basically
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Ending {
|
pub struct Ending {
|
||||||
id: String,
|
id: String,
|
||||||
dialogue: String,
|
dialogue: String,
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::str::FromStr;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub enum Transition {
|
pub enum Transition {
|
||||||
None,
|
None,
|
||||||
FadeToWhite,
|
FadeToWhite,
|
||||||
|
@ -51,7 +51,7 @@ impl ToString for Transition {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Exit {
|
pub struct Exit {
|
||||||
/// destination
|
/// destination
|
||||||
pub room_id: u64,
|
pub room_id: u64,
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl Version {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
pub struct Game {
|
pub struct Game {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub version: Option<Version>,
|
pub version: Option<Version>,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Image {
|
pub struct Image {
|
||||||
pub pixels: Vec<u8>, // 64 for SD, 256 for HD
|
pub pixels: Vec<u8>, // 64 for SD, 256 for HD
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36};
|
use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36};
|
||||||
use crate::image::animation_frames_from_string;
|
use crate::image::animation_frames_from_string;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Item {
|
pub struct Item {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
pub animation_frames: Vec<Image>,
|
pub animation_frames: Vec<Image>,
|
||||||
|
|
|
@ -36,13 +36,13 @@ use text::{Font, TextDirection};
|
||||||
use tile::Tile;
|
use tile::Tile;
|
||||||
use variable::Variable;
|
use variable::Variable;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Instance {
|
pub struct Instance {
|
||||||
position: Position,
|
position: Position,
|
||||||
id: String, // item / ending.rs id
|
id: String, // item / ending.rs id
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct ExitInstance {
|
pub struct ExitInstance {
|
||||||
position: Position,
|
position: Position,
|
||||||
exit: Exit,
|
exit: Exit,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::colour::Colour;
|
use crate::colour::Colour;
|
||||||
use crate::{from_base36, ToBase36};
|
use crate::{from_base36, ToBase36};
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Palette {
|
pub struct Palette {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Position {
|
pub struct Position {
|
||||||
pub x: u8,
|
pub x: u8,
|
||||||
pub y: u8,
|
pub y: u8,
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::game::{RoomType, RoomFormat};
|
||||||
use crate::exit::Transition;
|
use crate::exit::Transition;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Room {
|
pub struct Room {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
pub palette_id: Option<u64>, // optional in very early versions
|
pub palette_id: Option<u64>, // optional in very early versions
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::{from_base36, optional_data_line, AnimationFrames, Image, Position, T
|
||||||
use crate::image::animation_frames_from_string;
|
use crate::image::animation_frames_from_string;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Sprite {
|
pub struct Sprite {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub enum Font {
|
pub enum Font {
|
||||||
AsciiSmall, // default - does not appear in game data
|
AsciiSmall, // default - does not appear in game data
|
||||||
UnicodeEuropeanSmall,
|
UnicodeEuropeanSmall,
|
||||||
|
@ -32,7 +32,7 @@ impl Font {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub enum TextDirection {
|
pub enum TextDirection {
|
||||||
LeftToRight, // default
|
LeftToRight, // default
|
||||||
RightToLeft,
|
RightToLeft,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36};
|
use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36};
|
||||||
use crate::image::animation_frames_from_string;
|
use crate::image::animation_frames_from_string;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Tile {
|
pub struct Tile {
|
||||||
pub id: u64,
|
pub id: u64,
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||||
pub struct Variable {
|
pub struct Variable {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub initial_value: String,
|
pub initial_value: String,
|
||||||
|
|
Loading…
Reference in New Issue