diff options
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/character.rs | 3 | ||||
-rw-r--r-- | src/entities/entity_char.rs | 2 | ||||
-rw-r--r-- | src/entities/item.rs | 2 | ||||
-rw-r--r-- | src/entities/raw_types.rs | 4 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/entities/character.rs b/src/entities/character.rs index 360478e8be1c..3e8336b129ff 100644 --- a/src/entities/character.rs +++ b/src/entities/character.rs @@ -1,4 +1,5 @@ use crate::display; +use crate::entities::item::Item; use crate::types::{Position, Speed}; use std::io::{self, Write}; @@ -7,6 +8,7 @@ const DEFAULT_SPEED: Speed = Speed(100); entity! { pub struct Character { pub o_name: Option<String>, + pub inventory: Vec<Box<Item>>, } } @@ -18,6 +20,7 @@ impl Character { id: None, position: Position { x: 0, y: 0 }, o_name: None, + inventory: Vec::new(), } } diff --git a/src/entities/entity_char.rs b/src/entities/entity_char.rs index 88ca8a55a823..70f26bfffdbd 100644 --- a/src/entities/entity_char.rs +++ b/src/entities/entity_char.rs @@ -2,7 +2,7 @@ use crate::display::color::Color; use std::fmt::{self, Display, Formatter}; use termion::color; -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, PartialEq, Eq)] pub struct EntityChar { #[serde(default)] color: Color, diff --git a/src/entities/item.rs b/src/entities/item.rs index aa99fb42e2c1..5f08780d4fb2 100644 --- a/src/entities/item.rs +++ b/src/entities/item.rs @@ -4,7 +4,7 @@ use crate::entities::{Describe, EntityID}; use crate::types::Position; use std::io::{self, Write}; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct Item { pub id: Option<EntityID>, pub typ: &'static ItemType<'static>, diff --git a/src/entities/raw_types.rs b/src/entities/raw_types.rs index 59dd19ed2fa2..4bc291b69580 100644 --- a/src/entities/raw_types.rs +++ b/src/entities/raw_types.rs @@ -17,7 +17,7 @@ pub struct CreatureType<'a> { pub friendly: bool, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, PartialEq, Eq)] pub struct EdibleItem<'a> { #[serde(borrow)] pub eat_message: Option<Message<'a>>, @@ -26,7 +26,7 @@ pub struct EdibleItem<'a> { pub hitpoints_healed: u16, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, PartialEq, Eq)] pub struct ItemType<'a> { pub name: &'a str, |