Browse Source

don't load shops for real this time

pull/135/head
jake 1 year ago
committed by andy
parent
commit
579f10f08e
  1. 11
      src/ship/ship.rs
  2. 10
      tests/common.rs

11
src/ship/ship.rs

@ -412,14 +412,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())),

10
tests/common.rs

@ -36,6 +36,10 @@ 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]
@ -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