add random seed to roomstate

This commit is contained in:
jake 2020-04-21 07:20:25 -06:00
parent 58e8e52918
commit 3d9e868183

View File

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