Browse Source

make inv item stuff serializable

pbs
jake 4 years ago
parent
commit
2d5f83fab6
  1. 8
      src/entity/item/mod.rs
  2. 3
      src/ship/items/mod.rs

8
src/entity/item/mod.rs

@ -17,10 +17,10 @@ use crate::ship::drops::ItemDropType;
pub struct ItemEntityId(pub u32);
#[derive(Hash, PartialEq, Eq, Debug, Clone)]
pub struct ItemId(u32);
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)]
pub struct BankName(pub String);
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum ItemLocation {
Inventory {
character_id: CharacterEntityId,
@ -167,7 +167,7 @@ pub struct NewItemEntity {
pub item: ItemDetail,
}
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ItemEntity {
pub id: ItemEntityId,
pub location: ItemLocation,
@ -175,7 +175,7 @@ pub struct ItemEntity {
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum InventoryItemEntity {
Individual(ItemEntity),
Stacked(Vec<ItemEntity>),

3
src/ship/items/mod.rs

@ -3,8 +3,9 @@ mod floor;
mod inventory;
mod manager;
pub mod use_tool;
use serde::{Serialize, Deserialize};
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)]
pub struct ClientItemId(pub u32);
// TODO: remove these and fix use statements in the rest of the codebase

Loading…
Cancel
Save