Browse Source

why did I make this generic over rng anyway its not like I was ever gonna use that

pull/127/head
jake 2 years ago
parent
commit
e5f13b6cb7
  1. 12
      src/ship/drops/mod.rs
  2. 2
      src/ship/room.rs

12
src/ship/drops/mod.rs

@ -112,7 +112,7 @@ pub struct ItemDrop {
}
pub struct DropTable<R: Rng + SeedableRng> {
pub struct DropTable {
monster_stats: HashMap<MonsterType, MonsterDropStats>,
rare_table: RareDropTable,
weapon_table: GenericWeaponTable,
@ -121,11 +121,11 @@ pub struct DropTable<R: Rng + SeedableRng> {
unit_table: GenericUnitTable,
tool_table: ToolTable,
box_table: BoxDropTable,
rng: R,
rng: rand_chacha::ChaCha20Rng,
}
impl<R: Rng + SeedableRng> DropTable<R> {
pub fn new(episode: Episode, difficulty: Difficulty, section_id: SectionID) -> DropTable<R> {
impl DropTable {
pub fn new(episode: Episode, difficulty: Difficulty, section_id: SectionID) -> DropTable {
let monster_stats: HashMap<String, MonsterDropStats> = load_data_file(episode, difficulty, section_id, "monster_dar.toml");
DropTable {
@ -137,7 +137,7 @@ impl<R: Rng + SeedableRng> DropTable<R> {
unit_table: GenericUnitTable::new(episode, difficulty, section_id),
tool_table: ToolTable::new(episode, difficulty, section_id),
box_table: BoxDropTable::new(episode, difficulty, section_id),
rng: R::from_entropy(),
rng: rand_chacha::ChaCha20Rng::from_entropy(),
}
}
@ -203,6 +203,6 @@ mod test {
let section_id = vec![SectionID::Viridia, SectionID::Greenill, SectionID::Skyly, SectionID::Bluefull, SectionID::Purplenum,
SectionID::Pinkal, SectionID::Redria, SectionID::Oran, SectionID::Yellowboze, SectionID::Whitill]
.into_iter().choose(&mut rng).unwrap();
DropTable::<rand_chacha::ChaCha20Rng>::new(episode, difficulty, section_id);
DropTable::new(episode, difficulty, section_id);
}
}

2
src/ship/room.rs

@ -310,7 +310,7 @@ pub struct RoomState {
pub name: String,
pub password: [u16; 16],
pub maps: Maps,
pub drop_table: Box<DropTable<rand_chacha::ChaCha20Rng>>,
pub drop_table: Box<DropTable>,
pub section_id: SectionID,
pub random_seed: u32,
pub bursting: bool,

Loading…
Cancel
Save