Browse Source

add item_state to ShipState

pull/113/head
jake 3 years ago
parent
commit
11bc777a51
  1. 21
      Cargo.lock
  2. 3
      src/ship/ship.rs

21
Cargo.lock

@ -597,6 +597,7 @@ dependencies = [
"derive_more", "derive_more",
"enum-utils", "enum-utils",
"fern", "fern",
"fix-hidden-lifetime-bug",
"futures", "futures",
"lazy_static", "lazy_static",
"libpso", "libpso",
@ -679,6 +680,26 @@ dependencies = [
"log", "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]] [[package]]
name = "foreign-types" name = "foreign-types"
version = "0.3.2" version = "0.3.2"

3
src/ship/ship.rs

@ -62,6 +62,7 @@ pub enum ShipError {
PickUpInvalidItemId(u32), PickUpInvalidItemId(u32),
DropInvalidItemId(u32), DropInvalidItemId(u32),
ItemManagerError(#[from] items::ItemManagerError), ItemManagerError(#[from] items::ItemManagerError),
ItemStateError(#[from] items::state::ItemStateError),
#[error("")] #[error("")]
ItemDropLocationNotSet, ItemDropLocationNotSet,
BoxAlreadyDroppedItem(ClientId, u16), BoxAlreadyDroppedItem(ClientId, u16),
@ -404,6 +405,7 @@ impl<EG: EntityGateway> ShipServerStateBuilder<EG> {
level_table: CharacterLevelTable::default(), level_table: CharacterLevelTable::default(),
name: self.name.unwrap_or_else(|| "NAMENOTSET".into()), name: self.name.unwrap_or_else(|| "NAMENOTSET".into()),
item_manager: items::ItemManager::default(), item_manager: items::ItemManager::default(),
item_state: items::state::ItemState::default(),
ip: self.ip.unwrap_or_else(|| Ipv4Addr::new(127,0,0,1)), ip: self.ip.unwrap_or_else(|| Ipv4Addr::new(127,0,0,1)),
port: self.port.unwrap_or(SHIP_PORT), port: self.port.unwrap_or(SHIP_PORT),
shops: Box::new(ItemShops::default()), shops: Box::new(ItemShops::default()),
@ -448,6 +450,7 @@ pub struct ShipServerState<EG: EntityGateway> {
level_table: CharacterLevelTable, level_table: CharacterLevelTable,
name: String, name: String,
item_manager: items::ItemManager, item_manager: items::ItemManager,
item_state: items::state::ItemState,
shops: Box<ItemShops>, shops: Box<ItemShops>,
pub blocks: Blocks, pub blocks: Blocks,

Loading…
Cancel
Save