From 579f10f08ea7e65f8288961a07070510838da089 Mon Sep 17 00:00:00 2001 From: jake Date: Sat, 11 Nov 2023 23:11:58 -0700 Subject: [PATCH] don't load shops for real this time --- src/ship/ship.rs | 11 +++++------ tests/common.rs | 12 +++++------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/ship/ship.rs b/src/ship/ship.rs index efa026a..f9816c2 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -412,14 +412,13 @@ impl ShipServerStateBuilder { 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), - #[allow(clippy::box_default)] // this lint leads to another which just doesn't work - shops: Arc::new(self.shops.unwrap_or(Box::new(StandardItemShops::default()))), + shops: Arc::new(self.shops.unwrap_or_else(|| Box::::default())), blocks: Blocks(blocks), event: self.event.unwrap_or(Holiday::None), - map_builder: Arc::new(self.map_builder.unwrap_or(Box::new(generate_free_roam_maps))), - drop_table_builder: Arc::new(self.drop_table_builder.unwrap_or(Box::new(StandardDropTable::new))), - standard_quest_builder: Arc::new(self.standard_quest_builder.unwrap_or(Box::new(load_standard_quests))), - government_quest_builder: Arc::new(self.government_quest_builder.unwrap_or(Box::new(load_government_quests))), + map_builder: Arc::new(self.map_builder.unwrap_or_else(|| Box::new(generate_free_roam_maps))), + drop_table_builder: Arc::new(self.drop_table_builder.unwrap_or_else(|| Box::new(StandardDropTable::new))), + standard_quest_builder: Arc::new(self.standard_quest_builder.unwrap_or_else(|| Box::new(load_standard_quests))), + government_quest_builder: Arc::new(self.government_quest_builder.unwrap_or_else(|| Box::new(load_government_quests))), auth_token: self.auth_token.unwrap_or_else(|| AuthToken("".into())), ship_list: Arc::new(RwLock::new(Vec::new())), diff --git a/tests/common.rs b/tests/common.rs index f446d37..36c0d7a 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -36,10 +36,14 @@ impl DropTable for NullDropTable { } } +pub fn null_drop_table_builder(_episode: Episode, _difficult: Difficulty, _section_id: SectionID) -> Box { + Box::new(NullDropTable) +} + struct NullItemShops; #[async_trait::async_trait] -impl ItemShops for NullItemShops { +impl ItemShops for NullItemShops { async fn generate_weapon_list(&self, _difficulty: Difficulty, _section_id: SectionID, _char_level: usize) -> Option> { Some(Vec::new()) } @@ -51,12 +55,6 @@ impl ItemShops for NullItemShops { } } - - -pub fn null_drop_table_builder(_episode: Episode, _difficult: Difficulty, _section_id: SectionID) -> Box { - Box::new(NullDropTable) -} - pub fn standard_ship_buildable(gateway: EG) -> ShipServerStateBuilder { ShipServerState::builder() .gateway(gateway)