Browse Source

add random seed to roomstate

pbs
jake 5 years ago
parent
commit
3d9e868183
  1. 5
      src/ship/room.rs

5
src/ship/room.rs

@ -1,5 +1,6 @@
use std::convert::{From, Into, TryFrom, TryInto}; use std::convert::{From, Into, TryFrom, TryInto};
use rand::Rng;
use crate::ship::map::Maps; use crate::ship::map::Maps;
use crate::ship::drops::DropTable; use crate::ship::drops::DropTable;
use crate::entity::character::SectionID; use crate::entity::character::SectionID;
@ -126,6 +127,8 @@ pub struct RoomState {
//pub maps: [u32; 0x20], //pub maps: [u32; 0x20],
pub maps: Maps, pub maps: Maps,
pub drop_table: Box<DropTable<rand_chacha::ChaCha20Rng>>, pub drop_table: Box<DropTable<rand_chacha::ChaCha20Rng>>,
pub section_id: SectionID,
pub random_seed: u32,
// items on ground // items on ground
// enemy info // enemy info
} }
@ -198,9 +201,11 @@ impl RoomState {
Ok(RoomState { Ok(RoomState {
mode: room_mode, mode: room_mode,
random_seed: rand::thread_rng().gen(),
name: String::from_utf16_lossy(&create_room.name).trim_matches(char::from(0)).into(), name: String::from_utf16_lossy(&create_room.name).trim_matches(char::from(0)).into(),
password: create_room.password, password: create_room.password,
maps: Maps::new(room_mode.episode()), maps: Maps::new(room_mode.episode()),
section_id: section_id,
drop_table: Box::new(DropTable::new(room_mode.episode(), room_mode.difficulty(), section_id)), drop_table: Box::new(DropTable::new(room_mode.episode(), room_mode.difficulty(), section_id)),
}) })
} }

Loading…
Cancel
Save