From 11bc777a517ad811f8f05d61073648aa37486180 Mon Sep 17 00:00:00 2001 From: jake Date: Sat, 30 Apr 2022 11:39:12 -0600 Subject: [PATCH] add item_state to ShipState --- Cargo.lock | 21 +++++++++++++++++++++ src/ship/ship.rs | 3 +++ 2 files changed, 24 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index f134f13..6ed5058 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -597,6 +597,7 @@ dependencies = [ "derive_more", "enum-utils", "fern", + "fix-hidden-lifetime-bug", "futures", "lazy_static", "libpso", @@ -679,6 +680,26 @@ dependencies = [ "log", ] +[[package]] +name = "fix-hidden-lifetime-bug" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ae9c2016a663983d4e40a9ff967d6dcac59819672f0b47f2b17574e99c33c8" +dependencies = [ + "fix-hidden-lifetime-bug-proc_macros", +] + +[[package]] +name = "fix-hidden-lifetime-bug-proc_macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4c81935e123ab0741c4c4f0d9b8377e5fb21d3de7e062fa4b1263b1fbcba1ea" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "foreign-types" version = "0.3.2" diff --git a/src/ship/ship.rs b/src/ship/ship.rs index 4cf5e2a..f7b8b5a 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -62,6 +62,7 @@ pub enum ShipError { PickUpInvalidItemId(u32), DropInvalidItemId(u32), ItemManagerError(#[from] items::ItemManagerError), + ItemStateError(#[from] items::state::ItemStateError), #[error("")] ItemDropLocationNotSet, BoxAlreadyDroppedItem(ClientId, u16), @@ -404,6 +405,7 @@ impl ShipServerStateBuilder { level_table: CharacterLevelTable::default(), name: self.name.unwrap_or_else(|| "NAMENOTSET".into()), item_manager: items::ItemManager::default(), + item_state: items::state::ItemState::default(), ip: self.ip.unwrap_or_else(|| Ipv4Addr::new(127,0,0,1)), port: self.port.unwrap_or(SHIP_PORT), shops: Box::new(ItemShops::default()), @@ -448,6 +450,7 @@ pub struct ShipServerState { level_table: CharacterLevelTable, name: String, item_manager: items::ItemManager, + item_state: items::state::ItemState, shops: Box, pub blocks: Blocks,