Browse Source

don't load shops for real this time

pull/141/head
jake 1 year ago
parent
commit
ab0a844c8c
  1. 11
      src/ship/ship.rs
  2. 12
      tests/common.rs

11
src/ship/ship.rs

@ -410,14 +410,13 @@ impl<EG: EntityGateway + Clone + 'static> ShipServerStateBuilder<EG> {
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::<StandardItemShops>::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())),

12
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<dyn DropTable + Send + Sync> {
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<Vec<WeaponShopItem>> {
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<dyn DropTable + Send + Sync> {
Box::new(NullDropTable)
}
pub fn standard_ship_buildable<EG: EntityGateway + Clone>(gateway: EG) -> ShipServerStateBuilder<EG> {
ShipServerState::builder()
.gateway(gateway)

Loading…
Cancel
Save